package tools;

import client.MapleBuffStat;
import client.MapleCharacter;
import client.MapleClient;
import client.MapleDisease;
import client.MapleKeyLayout;
import client.MapleQuestStatus;
import client.MapleStat;
import client.MapleStat.Temp;
import client.MapleTrait;
import client.MapleTrait.MapleTraitType;
import client.MonsterBook;
import client.MonsterFamiliar;
import client.PlayerStats;
import client.Skill;
import client.SkillMacro;
import client.inventory.Equip;
import client.inventory.Equip.ScrollResult;
import client.inventory.Item;
import client.inventory.MapleImp;
import client.inventory.MapleImp.ImpFlag;
import client.inventory.MapleInventory;
import client.inventory.MapleInventoryType;
import client.inventory.MapleMount;
import client.inventory.MaplePet;
import client.inventory.MapleRing;
import constants.GameConstants;
import constants.ServerConstants;
import handling.SendPacketOpcode;
import handling.channel.handler.PlayerInteractionHandler;
import handling.world.MapleParty;
import handling.world.MaplePartyCharacter;
import handling.world.World.Alliance;
import handling.world.World.Guild;
import handling.world.guild.MapleGuild;
import handling.world.guild.MapleGuildAlliance;
import java.awt.Point;
import java.io.PrintStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.log4j.Logger;
import scripting.EventInstanceManager;
import server.MapleCarnivalParty;
import server.MapleDueyActions;
import server.MapleItemInformationProvider;
import server.MapleShop;
import server.MapleStatEffect;
import server.MapleTrade;
import server.Randomizer;
import server.ServerProperties;
import server.Start;
import server.StructFamiliar;
import server.events.MapleSnowball;
import server.events.MapleSnowball.MapleSnowballs;
import server.life.MapleMonster;
import server.life.MapleNPC;
import server.life.MobSkill;
import server.life.PlayerNPC;
import server.maps.MapleDragon;
import server.maps.MapleMap;
import server.maps.MapleMapItem;
import server.maps.MapleMist;
import server.maps.MapleNodes;
import server.maps.MapleNodes.MapleNodeInfo;
import server.maps.MapleNodes.MaplePlatform;
import server.maps.MapleQuickMove;
import server.maps.MapleReactor;
import server.maps.MapleSummon;
import server.maps.MechDoor;
import server.maps.SummonMovementType;
import server.movement.LifeMovementFragment;
import server.quest.MapleQuest;
import server.shops.HiredMerchant;
import server.shops.MaplePlayerShopItem;
import tools.data.MaplePacketLittleEndianWriter;
import tools.packet.PacketHelper;
import tools.packet.PetPacket;

public class MaplePacketCreator {

    private static final Logger log = Logger.getLogger(MaplePacketCreator.class);
    public static final Map<MapleStat, Integer> EMPTY_STATUPDATE = new EnumMap(MapleStat.class);
    public static int DEFAULT_BUFFMASK = 0;

    public static byte[] SystemProcess() {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SYSTEM_PROCESS_LIST.getValue());
        mplew.write(1);
        //mplew.writeZero(14);

        return mplew.getPacket();
    }
    
    public static byte[] getWzCheck(String WzCheckPack) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.WZ_CHECK.getValue());
        mplew.write(HexTool.getByteArrayFromHexString(WzCheckPack));
        return mplew.getPacket();
    }

    public static byte[] getServerIP(MapleClient c, int port, int clientId) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SERVER_IP.getValue());
        mplew.writeShort(0);
        /*if (c.getTempIP().length() > 0) {
            for (String s : c.getTempIP().split(",")) {
                mplew.write(Integer.parseInt(s));
            }
        } else {
            mplew.write(ServerConstants.Gateway_IP);
        }*/
        try{
            mplew.write(InetAddress.getByName(Start.SERVERIP).getAddress());
        }catch (UnknownHostException e){}
        mplew.writeShort(port);
        mplew.writeInt(clientId);
        mplew.write(1);
        mplew.writeInt(0);

        return mplew.getPacket();
    }

    public static byte[] getChannelChange(MapleClient c, int port) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CHANGE_CHANNEL.getValue());
        mplew.write(1);
        /*if (c.getTempIP().length() > 0) {
            for (String s : c.getTempIP().split(",")) {
                mplew.write(Integer.parseInt(s));
            }
        } else {*/
            //mplew.write(ServerConstants.Gateway_IP);//永恒改
        try{
            mplew.write(InetAddress.getByName(Start.SERVERIP).getAddress());
        }catch (UnknownHostException e){}
        //}
        mplew.writeShort(port);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] 退出游戏(){
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.EXIT_GAME.getValue());
    
    return mplew.getPacket();
    }
    
    public static byte[] 打开世界地图(){
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.OPEN_WORLD_MAP.getValue());
        mplew.writeInt(0);
    
    return mplew.getPacket();
    }
    
    public static byte[] 召唤符文(){
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPAWN_RUNE.getValue());
        mplew.writeMapleAsciiString("kill_count");
        mplew.write(1);
        mplew.write(0);
        mplew.write(48);
    
    return mplew.getPacket();
    }
    
    public static byte[] getCharInfo(MapleCharacter chr) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.WARP_TO_MAP.getValue());
        mplew.writeShort(1);
        mplew.writeInt(1);
        mplew.writeInt(0);
        mplew.writeLong(chr.getClient().getChannel() - 1);
        mplew.writeShort(0);
        mplew.writeInt(1);
        mplew.write(new byte[]{0, 1, 0, 0});
        for (int i = 0; i < 3; i++) {
            mplew.writeInt(Randomizer.nextInt());
        }

        PacketHelper.addCharacterInfo(mplew, chr);

        mplew.writeInt(0);

        //mplew.write(HexTool.getByteArrayFromHexString("A9 A5 E0 02 "));
        mplew.writeInt(chr.getAccountID());
        mplew.writeInt(chr.getId());  //我加的

        mplew.writeLong(5L);

        for (int x = 0; x < 4; x++) {
            mplew.writeLong(9410165 + x);
        }
        mplew.writeInt(9410198); //这里其实可以直接写个Long（9410198） 但是分成了2个Int
        mplew.writeInt(0);
        
        mplew.writeInt(chr.getId());//我加的
        mplew.writeLong(0L);
        mplew.writeLong(PacketHelper.getTime(System.currentTimeMillis()));
        //mplew.writeLong(PacketHelper.getTime(-2L));
        mplew.writeInt(30);

        mplew.writeShort(0);
        mplew.writeLong(0L);
        mplew.writeLong(0L);
        mplew.writeLong(PacketHelper.getTime(System.currentTimeMillis()));
        mplew.writeInt(100);
        mplew.writeShort(0);
        mplew.write(0);
        mplew.write(1);

        return mplew.getPacket();
    }

    public static byte[] enableActions() {
        return updatePlayerStats(EMPTY_STATUPDATE, true, null);
    }

    public static byte[] updatePlayerStats(Map<MapleStat, Integer> stats, MapleCharacter chr) {
        return updatePlayerStats(stats, false, chr);
    }

    public static byte[] updatePlayerStats(Map<MapleStat, Integer> mystats, boolean itemReaction, MapleCharacter chr) {
                if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.UPDATE_STATS.getValue());
        mplew.write(itemReaction ? 1 : 0);
        long updateMask = 0L;
        for (MapleStat statupdate : mystats.keySet()) {
            updateMask |= statupdate.getValue();
        }
        mplew.writeLong(updateMask);

        for (Map.Entry statupdate : mystats.entrySet()) {
            Long value = ((MapleStat) statupdate.getKey()).getValue();

            if (value >= 1L) {
                if (value == MapleStat.皮肤.getValue()) {
                    mplew.writeShort(((Integer) statupdate.getValue()).shortValue());
                } else if (value == MapleStat.职业.getValue()) {
                    mplew.writeInt(((Integer) statupdate.getValue()));
                } else if (value <= MapleStat.发型.getValue()) {
                    mplew.writeInt(((Integer) statupdate.getValue()));
                } else if ((value < MapleStat.职业.getValue()) || (value == MapleStat.疲劳.getValue()) || (value.longValue() == MapleStat.ICE_GAGE.getValue())) {
                    mplew.write(((Integer) statupdate.getValue()).byteValue());
                } else if (value == MapleStat.AVAILABLESP.getValue()) {
                    if ((GameConstants.is神之子(chr.getJob())) || (GameConstants.is林之灵(chr.getJob())) || ((GameConstants.is冒险家(chr.getJob())) && (!GameConstants.is龙的传人(chr.getJob()))) || (GameConstants.is骑士团(chr.getJob())) || (GameConstants.is尖兵(chr.getJob())) || (GameConstants.is恶魔复仇者(chr.getJob())) || (GameConstants.is狂龙(chr.getJob())) || (GameConstants.is萌天使(chr.getJob())) || (GameConstants.is夜光(chr.getJob())) || (GameConstants.is米哈尔(chr.getJob())) || (GameConstants.is龙神(chr.getJob())) || (GameConstants.is反抗者(chr.getJob())) || (GameConstants.is双弩精灵(chr.getJob())) || (GameConstants.is恶魔猎手(chr.getJob())) || (GameConstants.is幻影(chr.getJob()))) {
                        mplew.write(chr.getRemainingSpSize());
                        for (int i = 0; i < chr.getRemainingSps().length; i++) {
                            if (chr.getRemainingSp(i) > 0) {
                                mplew.write(i + 1);
                                mplew.write(chr.getRemainingSp(i));
                            }
                        }
                    } else {
                        mplew.writeShort(((Integer) statupdate.getValue()).shortValue());
                    }

                } else if ((value >= MapleStat.HP.getValue()) && (value <= MapleStat.MAXMP.getValue())) {
                    mplew.writeInt(((Integer) statupdate.getValue()));
                } else if (value < MapleStat.经验.getValue()) {
                    mplew.writeShort(((Integer) statupdate.getValue()).shortValue());
                } else if (value == MapleStat.TRAIT_LIMIT.getValue()) {
                    mplew.writeInt(((Integer) statupdate.getValue()));
                    mplew.writeInt(((Integer) statupdate.getValue()));
                    //mplew.writeInt(((Integer) statupdate.getValue()));
                } else if (value == MapleStat.宠物.getValue()) {
                    mplew.writeLong(((Integer) statupdate.getValue()));
                    mplew.writeLong(((Integer) statupdate.getValue()));
                    mplew.writeLong(((Integer) statupdate.getValue()));
                } else {
                    mplew.writeLong(((Integer) statupdate.getValue()));
                }
            }
        }

        if ((updateMask == 0L) && (!itemReaction)) {
            mplew.write(1);
        }
        mplew.write(0);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] 刷新金币或经验(Map<MapleStat, Long> mystats, boolean itemReaction, MapleCharacter chr) {
                if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.UPDATE_STATS.getValue());
        mplew.write(itemReaction ? 1 : 0);
        long updateMask = 0L;
        for (MapleStat statupdate : mystats.keySet()) {
            updateMask |= statupdate.getValue();
        }
        mplew.writeLong(updateMask);

        for (Map.Entry statupdate : mystats.entrySet()) {
            mplew.writeLong(((Long) statupdate.getValue()).longValue());
        }

        if ((updateMask == 0L) && (!itemReaction)) {
            mplew.write(1);
        }
        mplew.write(0);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] updateLevel(MapleCharacter chr, boolean itemReaction) {
        return updateLevel(chr, itemReaction, false);
    }

    private static byte[] updateLevel(MapleCharacter chr, boolean itemReaction, boolean b) {
        return updateLevel(chr, itemReaction, false);
    }

    public static byte[] updateSp(MapleCharacter chr, boolean itemReaction) {
        return updateSp(chr, itemReaction, false);
    }

    public static byte[] updateSp(MapleCharacter chr, boolean itemReaction, boolean overrideJob) {
                if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.UPDATE_STATS.getValue());
        mplew.write(itemReaction ? 1 : 0);
        mplew.writeLong(32768L);
        if ((overrideJob) || (GameConstants.is神之子(chr.getJob())) || ((GameConstants.is冒险家(chr.getJob())) && (!GameConstants.is龙的传人(chr.getJob()))) || (GameConstants.is骑士团(chr.getJob())) || (GameConstants.is尖兵(chr.getJob())) || (GameConstants.is恶魔复仇者(chr.getJob())) || (GameConstants.is狂龙(chr.getJob())) || (GameConstants.is萌天使(chr.getJob())) || (GameConstants.is夜光(chr.getJob())) || (GameConstants.is米哈尔(chr.getJob())) || (GameConstants.is龙神(chr.getJob())) || (GameConstants.is反抗者(chr.getJob())) || (GameConstants.is双弩精灵(chr.getJob())) || (GameConstants.is恶魔猎手(chr.getJob())) || (GameConstants.is幻影(chr.getJob()))) {
            mplew.write(chr.getRemainingSpSize());
            for (int i = 0; i < chr.getRemainingSps().length; i++) {
                if (chr.getRemainingSp(i) > 0) {
                    mplew.write(i + 1);
                    mplew.writeInt(chr.getRemainingSp(i));
                }
            }
        } else {
            mplew.writeShort(chr.getRemainingSp());
        }

        mplew.writeShort(0);
        return mplew.getPacket();
    }

public static byte[] getWarpToMap(MapleMap to, int spawnPoint, MapleCharacter chr) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.WARP_TO_MAP.getValue());
        mplew.writeShort(1);
        mplew.writeLong(1L);
        mplew.writeLong(chr.getClient().getChannel() - 1);
        mplew.writeShort(0);
        mplew.writeLong(2L);
        mplew.write(0);
        mplew.writeInt(to.getId());
        mplew.write(spawnPoint);
        mplew.writeInt(chr.getStat().getHp());
        mplew.write(0);
        mplew.write(0);
        mplew.writeLong(PacketHelper.getTime(System.currentTimeMillis()));
        mplew.writeInt(100);
        mplew.writeZeroBytes(3);
        mplew.write(1);

        return mplew.getPacket();
    }

    public static byte[] instantMapWarp(byte portal) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CURRENT_MAP_WARP.getValue());
        mplew.write(0);
        mplew.write(portal);

        return mplew.getPacket();
    }

    public static byte[] spawnPortal(int townId, int targetId, int skillId, Point pos) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPAWN_PORTAL.getValue());
        mplew.writeInt(townId);
        mplew.writeInt(targetId);
        if ((townId != 999999999) && (targetId != 999999999)) {
            mplew.writeInt(skillId);
            mplew.writePos(pos);
        }

        return mplew.getPacket();
    }

    public static byte[] spawnDoor(int oid, Point pos, boolean animation) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPAWN_DOOR.getValue());
        mplew.write(animation ? 0 : 1);
        mplew.writeInt(oid);
        mplew.writePos(pos);

        return mplew.getPacket();
    }

    public static byte[] removeDoor(int oid, boolean animation) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.REMOVE_DOOR.getValue());
        mplew.write(animation ? 0 : 1);
        mplew.writeInt(oid);

        return mplew.getPacket();
    }

    public static byte[] spawnSummon(MapleSummon summon, boolean animated) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPAWN_SUMMON.getValue());
        mplew.writeInt(summon.getOwnerId());
        mplew.writeInt(summon.getObjectId());
        mplew.writeInt(summon.getSkill());
        mplew.write(summon.getOwnerLevel());
        mplew.write(summon.getSkillLevel());
        mplew.writePos(summon.getPosition());

      /*  mplew.write((summon.getSkill() == 32111006) || (summon.getSkill() == 33101005) ? 5 : 4);
        mplew.writeShort((summon.getSkill() == 61111002) || (summon.getSkill() == 5711001) ? 0 : GameConstants.is风灵绿水晶花(summon.getSkill()) ? 0 : GameConstants.is尖兵全息力场(summon.getSkill()) ? 0 : 1);
        mplew.write(summon.getSummonType());
        mplew.write(summon.getMovementType().getValue());
        mplew.write((animated) || (GameConstants.is召唤傀儡(summon.getSkill())) || (summon.getSkill() == 4341006) ? 1 : 0);
        mplew.write((animated) || (GameConstants.is尖兵全息力场(summon.getSkill())) || (summon.getSkill() == 5711001) ? 1 : 0);*/
        MapleCharacter chr = summon.getOwner();
       // mplew.write((summon.getSkill() == 4341006) && (chr != null) ? 1 : 0);
        mplew.write(4);
        mplew.write(0);
        mplew.write(0);
        mplew.write(1);//1112586黑天使这是1
        mplew.write(2);//1112586黑天使这是2
        mplew.write(1);//1112586黑天使这是1
        mplew.writeInt(0);//119+
        mplew.write(0);
        mplew.write(1);//119+
        mplew.writeLong(0);//119+
        
        if (summon.getSkill() == 4341006) {
            mplew.write(1);
        }else{
        mplew.write(0);//119+
        }
        
        if ((summon.getSkill() == 4341006) && (chr != null)) {
            PacketHelper.addCharLook(mplew, chr, true, false, false);
        }
        if (summon.getSkill() == 35111002) {
            mplew.write(0);
        }

        return mplew.getPacket();
    }

    public static byte[] removeSummon(int ownerId, int objId) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.REMOVE_SUMMON.getValue());
        mplew.writeInt(ownerId);
        mplew.writeInt(objId);
        mplew.write(10);
        return mplew.getPacket();
    }

    public static byte[] removeSummon(MapleSummon summon, boolean animated) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.REMOVE_SUMMON.getValue());
        mplew.writeInt(summon.getOwnerId());
        mplew.writeInt(summon.getObjectId());
        if (animated) {
            switch (summon.getSkill()) {
                case 33101008:
                case 35111001:
                case 35111002:
                case 35111005:
                case 35111009:
                case 35111010:
                case 35111011:
                case 35121009:
                case 35121010:
                case 35121011:
                    mplew.write(5);
                    break;
                case 35121003:
                    mplew.write(10);
                    break;
                case 3111005:
                case 3211005:
                    mplew.write(12);
                    break;
                case 36121002:
                case 36121013:
                case 36121014:
                    mplew.write(0);
                    break;
                default:
                    mplew.write(3);
                    break;
            }
        } else {
            switch (summon.getSkill()) {
                case 3111005:
                case 3211005:
                    mplew.write(0);
                    break;
                default:
                    mplew.write(1);
            }
        }

        return mplew.getPacket();
    }

    public static byte[] serverBlocked(int type) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SERVER_BLOCKED.getValue());
        mplew.write(type);

        return mplew.getPacket();
    }

    public static byte[] pvpBlocked(int type) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_BLOCKED.getValue());
        mplew.write(type);

        return mplew.getPacket();
    }

    public static byte[] serverMessage(String message) {
        return serverMessage(4, 0, message, false);
    }

    public static byte[] serverNotice(int type, String message) {
        return serverMessage(type, 0, message, false);
    }
    
    public static byte[] serverSpouseNotice(int type, String message) {
        return serverSpouseMessage(type, 0, message, false);
    }    

    public static byte[] serverNotice(int type, int channel, String message) {
        return serverMessage(type, channel, message, false);
    }

    public static byte[] serverNotice(int type, int channel, String message, boolean smegaEar) {
        return serverMessage(type, channel, message, smegaEar);
    }
    private static byte[] serverSpouseMessage(int type, int channel, String message, boolean megaEar) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPOUSE_MESSAGE.getValue());
        mplew.writeShort(type);
        mplew.writeMapleAsciiString(message);

        return mplew.getPacket();
    }
    private static byte[] serverMessage(int type, int channel, String message, boolean megaEar) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SERVERMESSAGE.getValue());
        mplew.write(type);
        if (type == 4) {
            mplew.write(1);
        }else if(type == 20){
            mplew.write(0);
        }
        mplew.writeMapleAsciiString(message);
        switch (type) {
            case 3://高质地喇叭
            case 9:
            case 14:
            case 15:
            case 17:
            case 21:
            case 22:
            case 23:
            case 24: //红色蛋糕喇叭
            case 25: //黄色馅饼喇叭
            
                mplew.write(channel - 1);
                mplew.write(megaEar ? 1 : 0);
                break;
            case 6://蓝色公告喇叭
            case 16:
            case 18:
            case 26: //白色背景喇叭
                mplew.writeInt((channel >= 1000000) && (channel < 6000000) ? channel : 0);
                break;
            case 4:
            case 5://红色字体公告
            case 7:
            case 8:
            case 10:
            case 11:
            case 12:
            case 13:
            case 19:
            case 32:
            
            
        }
        return mplew.getPacket();
    }
/*       
        //这是GMS148的写法
        mplew.writeShort(SendPacketOpcode.SERVERMESSAGE.getValue());
        mplew.write(type);
        if (type == 4) {
            mplew.write(1);
        }
        if ((type != 23) && (type != 24)) {
            mplew.writeMapleAsciiString(message);
        }
        switch (type) {
            case 3:
            case 22:
            case 25:
            case 26:
                mplew.write(channel - 1);
                mplew.write(megaEar ? 1 : 0);
                break;
            case 9:
                mplew.write(channel - 1);
                break;
            case 12:
                mplew.writeInt(channel);
                break;
            case 6:
            case 11:
            case 20:
                mplew.writeInt((channel >= 1000000) && (channel < 6000000) ? channel : 0);
                break;
            case 24:
                mplew.writeShort(0);
            case 4:
            case 5:
            case 7:
            case 8:
            case 10:
            case 13:
            case 14:
            case 15:
            case 16:
            case 17:
            case 18:
            case 19:
            case 21:
            case 23:
        }
        return mplew.getPacket();
    }
*/
    public static byte[] 转蛋机喇叭(String name, String message, Item item, byte rareness, int channel) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        //22 4F 00 D0 ED CF C9 D7 FC D7 FC D7 FC D7 FA 20 3A 20 CE D2 B4 D3 D7 AA B5 B0 BB FA D6 D0 BB F1 B5 C3 C1 CB 7B C6 A4 D1 C7 C5 AC CB B9 C1 E9 BB EA BD E1 BE A7 CB E9 C6 AC 7D A3 A1 B4 F3 BC D2 D2 BB C6 F0 B9 A7 CF B2 CE D2 B0 C9 A3 A1 A3 A1 A3 A1 97 1B 25 00 09 00 00 00 00 00 00 00 01 02 97 1B 25 00 00 00 80 05 BB 46 E6 17 02 FF FF FF FF 01 00 00 00 00 00 00 00
        mplew.writeShort(SendPacketOpcode.SERVERMESSAGE.getValue());
        mplew.write(rareness == 2 ? 32 : 32);//118是34
        mplew.writeMapleAsciiString(new StringBuilder().append(name).append(message).toString());
        mplew.writeInt(item.getItemId());

        mplew.writeInt(channel - 1);
        mplew.writeInt(0);
        mplew.write(1);
        PacketHelper.addItemInfo(mplew, item, true, true);

        return mplew.getPacket();
    }

    public static byte[] 发送玩家带颜色背景公告(String name, String message, int 类型, int channel) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SERVERMESSAGE.getValue());
        mplew.write(类型);
        mplew.writeMapleAsciiString(new StringBuilder().append(name).append(message).toString());
        mplew.write(channel - 1);
        mplew.write(1);

        return mplew.getPacket();
    }

    public static byte[] 发送新玩家信息(String name, String message, Item item, int channel) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SERVERMESSAGE.getValue());
        mplew.write(8);

        mplew.writeMapleAsciiString(new StringBuilder().append(name).append(message).toString());
        mplew.writeInt(item.getItemId());

        mplew.write(channel - 1);

        mplew.write(1);
        PacketHelper.addItemInfo(mplew, item, true, true);

        return mplew.getPacket();
    }

    public static byte[] 喇叭_转蛋机(String message, int itemId) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SERVERMESSAGE.getValue());
        mplew.write(11);
        mplew.writeMapleAsciiString(message);
        mplew.writeInt(itemId);

        return mplew.getPacket();
    }

    public static byte[] getAniMsg(int questID, int time) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SERVERMESSAGE.getValue());
        mplew.write(14);
        mplew.writeShort(questID);
        mplew.writeInt(time);

        return mplew.getPacket();
    }

    
    public static byte[] 喇叭_缤纷(List<String> message, boolean ear, int channel) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SERVERMESSAGE.getValue());
        mplew.write(10);
        if (message.get(0) != null) {
            mplew.writeMapleAsciiString((String) message.get(0));
        }
        mplew.write(message.size());
        for (int i = 1; i < message.size(); i++) {
            if (message.get(i) != null) {
                mplew.writeMapleAsciiString((String) message.get(i));
            }
        }
        mplew.write(channel - 1);
        mplew.write(ear ? 1 : 0);

        return mplew.getPacket();
    }

    public static byte[] 喇叭_情景(MapleCharacter chr, int channel, int itemId, String message, String message1, String message2, String message3, boolean ear) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.AVATAR_MEGA.getValue());
        mplew.writeInt(itemId);
        mplew.writeMapleAsciiString(chr.getName());
        mplew.writeMapleAsciiString(message);
        mplew.writeMapleAsciiString(message1);
        mplew.writeMapleAsciiString(message2);
        mplew.writeMapleAsciiString(message3);
        mplew.writeInt(channel - 1);
        mplew.write(ear ? 1 : 0);
        PacketHelper.addCharLook(mplew, chr, true, false, true);

        return mplew.getPacket();
    }

    public static byte[] 喇叭_道具(String msg, boolean whisper, int channel, Item item) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SERVERMESSAGE.getValue());
        mplew.write(8);
        mplew.writeMapleAsciiString(msg);
        mplew.write(channel - 1);
        mplew.write(whisper ? 1 : 0);
        if (item == null) {
            mplew.write(0);
        } else {
            PacketHelper.addItemInfo(mplew, item, false, false, true);
        }
        return mplew.getPacket();
    }

    public static byte[] 喇叭_回声(String name, String message) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.ECHO_MESSAGE.getValue());
        mplew.write(0);
        mplew.writeLong(PacketHelper.getTime(System.currentTimeMillis()));
        mplew.writeMapleAsciiString(name);
        mplew.writeMapleAsciiString(message);

        return mplew.getPacket();
    }

    public static byte[] NPC_召唤0(MapleNPC life, boolean show) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPAWN_NPC.getValue());
        mplew.writeInt(life.getObjectId());
        mplew.writeInt(life.getId());
        mplew.writeShort(life.getPosition().x);
        mplew.writeShort(life.getCy());
        mplew.write(life.getF() == 1 ? 0 : 1);
        mplew.writeShort(life.getFh());
        mplew.writeShort(life.getRx0());
        mplew.writeShort(life.getRx1());
        mplew.write(show ? 1 : 0);
        mplew.writeInt(0);
        mplew.writeInt(0);//118+
        mplew.write(0);//118+
        mplew.writeInt(-1);//118+
        mplew.writeInt(0);//120+

        return mplew.getPacket();
    }

    public static byte[] NPC_删除0(int objectid) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.REMOVE_NPC.getValue());
        mplew.writeInt(objectid);

        return mplew.getPacket();
    }

    public static byte[] NPC_删除_请求控制权0(int objectid) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPAWN_NPC_REQUEST_CONTROLLER.getValue());
        mplew.write(0);
        mplew.writeInt(objectid);

        return mplew.getPacket();
    }

    public static byte[] NPC_召唤_请求控制权0(MapleNPC life, boolean MiniMap) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPAWN_NPC_REQUEST_CONTROLLER.getValue());
        mplew.write(1);
        mplew.writeInt(life.getObjectId());
        mplew.writeInt(life.getId());
        mplew.writeShort(life.getPosition().x);
        mplew.writeShort(life.getCy());
        mplew.write(life.getF() == 1 ? 0 : 1);
        mplew.writeShort(life.getFh());
        mplew.writeShort(life.getRx0());
        mplew.writeShort(life.getRx1());
        mplew.write(MiniMap ? 1 : 0);
        mplew.writeInt(0);

        return mplew.getPacket();
    }

    public static byte[] PlayerNPC_召唤0(PlayerNPC npc) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.PLAYER_NPC.getValue());
        mplew.write(npc.getF() == 1 ? 0 : 1);
        mplew.writeInt(npc.getId());
        mplew.writeMapleAsciiString(npc.getName());
        mplew.write(npc.getGender());
        mplew.write(npc.getSkin());
        mplew.writeInt(npc.getFace());
        mplew.writeInt(0);
        mplew.write(0);
        mplew.writeInt(npc.getHair());
        Map<Byte, Integer> equip = npc.getEquips();
        Map<Byte, Integer> myEquip = new LinkedHashMap();
        Map<Byte, Integer> maskedEquip = new LinkedHashMap();
        for (Entry<Byte, Integer> position : equip.entrySet()) {
            byte pos = (byte) (((Byte) position.getKey()).byteValue() * -1);
            if ((pos < 100) && (myEquip.get(Byte.valueOf(pos)) == null)) {
                myEquip.put(Byte.valueOf(pos), position.getValue());
            } else if ((pos > 100) && (pos != 111)) {
                pos = (byte) (pos - 100);
                if (myEquip.get(Byte.valueOf(pos)) != null) {
                    maskedEquip.put(Byte.valueOf(pos), myEquip.get(Byte.valueOf(pos)));
                }
                myEquip.put(Byte.valueOf(pos), position.getValue());
            } else if (myEquip.get(Byte.valueOf(pos)) != null) {
                maskedEquip.put(Byte.valueOf(pos), position.getValue());
            }
        }
        for (Map.Entry entry : myEquip.entrySet()) {
            mplew.write(((Byte) entry.getKey()).byteValue());
            mplew.writeInt(((Integer) entry.getValue()).intValue());
        }
        mplew.write(255);
        for (Map.Entry entry : maskedEquip.entrySet()) {
            mplew.write(((Byte) entry.getKey()).byteValue());
            mplew.writeInt(((Integer) entry.getValue()).intValue());
        }
        mplew.write(255);
        Integer cWeapon = (Integer) equip.get(Byte.valueOf((byte) -111));
        if (cWeapon != null) {
            mplew.writeInt(cWeapon.intValue());
        } else {
            mplew.writeInt(0);
        }
        for (int i = 0; i < 3; i++) {
            mplew.writeInt(npc.getPet(i));
        }

        return mplew.getPacket();
    }

    public static byte[] getChatText(int cidfrom, String text, boolean whiteBG, int show) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CHATTEXT.getValue());
        mplew.writeInt(cidfrom);
        mplew.write(whiteBG ? 1 : 0);
        mplew.writeMapleAsciiString(text);
        mplew.writeShort(show);
        mplew.write(-1);

        return mplew.getPacket();
    }

    public static byte[] GameMaster_Func(int value) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GM_EFFECT.getValue());
        mplew.write(value);
        mplew.writeZeroBytes(17);

        return mplew.getPacket();
    }

    public static byte[] 战神连击(int value) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.ARAN_COMBO.getValue());
        mplew.writeInt(value);

        return mplew.getPacket();
    }

    /**
     *战神连击充电？
     * @param value
     * @return
     */
    public static byte[] rechargeCombo(int value) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.ARAN_COMBO_RECHARGE.getValue());
        mplew.writeInt(value);

        return mplew.getPacket();
    }

    public static byte[] getPacketFromHexString(String hex) {
        return HexTool.getByteArrayFromHexString(hex);
    }

    /**
     *打怪获得的经验
     * @param gain
     * @param white
     * @param 组队经验
     * @param 精灵祝福经验
     * @param 道具佩戴经验
     * @param 召回戒指经验
     * @param Sidekick_Bonus_EXP
     * @param 网吧特别经验
     * @param 结婚奖励经验
     * @return
     */
    public static byte[] 伤害皮肤(int sink){
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.writeInt(18643713);
        mplew.writeShort(1);
        mplew.write(sink);
         
    return mplew.getPacket();
    }
    
    public static byte[] GainEXP_Monster(int gain, boolean white, int 组队经验, int 精灵祝福经验, int 道具佩戴经验, int 召回戒指经验, int Sidekick_Bonus_EXP, int 网吧特别经验, int 结婚奖励经验) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(3);
        mplew.write(white ? 1 : 0);
        mplew.writeInt(gain);
        mplew.write(0);
        
        mplew.writeInt(0);
        mplew.writeInt(组队经验);
        mplew.writeInt(道具佩戴经验);
        mplew.writeInt(精灵祝福经验);

        mplew.writeInt(召回戒指经验);
        mplew.writeInt(结婚奖励经验);

        mplew.writeInt(0);

        mplew.writeInt(网吧特别经验);

        return mplew.getPacket();
    }
    
    public static byte[] 怪物_连续击杀经验(long gain, boolean white, int Combo) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(34);
        mplew.write(white ? 1 : 0);
        mplew.writeLong(gain);
        mplew.writeInt(Combo);
        //mplew.writeInt(moid);
        mplew.writeInt(17297943);

        return mplew.getPacket();
    }
    
    public static byte[] 怪物_3连杀经验(long gain, boolean white, int Combo) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(34);
        mplew.write(white ? 1 : 0);
        mplew.writeLong(gain);
        mplew.writeInt(Combo);

        return mplew.getPacket();
    }

    public static byte[] GainEXP_Others(long gain, boolean inChat, boolean white) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(3);
        mplew.write(white ? 1 : 0);
        mplew.writeLong(gain);
        mplew.write(inChat ? 1 : 0);
        mplew.writeZeroBytes(51);

        if (inChat) {
            mplew.write(0);
        }

        return mplew.getPacket();
    }

    public static byte[] getShowFameGain(int gain) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(5);
        mplew.writeInt(gain);

        return mplew.getPacket();
    }

    /**
     *捡起金币掉线是这里问题
     * @param gain 金币数量
     * @param inChat
     * @return
     */
    public static byte[] 显示金币数量(long gain, boolean inChat) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        if (!inChat) {
            mplew.write(0);
            mplew.write(1);
            mplew.write(0);
            mplew.writeInt((int) gain);
            mplew.writeShort(0);
            mplew.writeShort(0);//117+
        } else {
            mplew.write(6);
            mplew.writeLong(gain);
            mplew.writeInt(-1);
        }

        return mplew.getPacket();
    }

    public static byte[] getShowItemGain(int itemId, short quantity) {
        return getShowItemGain(itemId, quantity, false);
    }

    public static byte[] getShowItemGain(int itemId, short quantity, boolean inChat) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (inChat) {
            mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
            mplew.write(5);
            mplew.write(1);
            mplew.writeInt(itemId);
            mplew.writeInt(quantity);
        } else {
            mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
            mplew.writeShort(0);
            mplew.writeInt(itemId);
            mplew.writeInt(quantity);
        }
        return mplew.getPacket();
    }

    public static byte[] getShowItemGain(Map<Integer, Integer> showItems) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
        mplew.write(5);
        mplew.write(showItems.size());
        for (Map.Entry items : showItems.entrySet()) {
            mplew.writeInt(((Integer) items.getKey()).intValue());
            mplew.writeInt(((Integer) items.getValue()).intValue());
        }
        return mplew.getPacket();
    }

    public static byte[] getShowItemGain(List<Pair<Integer, Integer>> showItems) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
        mplew.write(5);
        mplew.write(showItems.size());
        for (Pair items : showItems) {
            mplew.writeInt(((Integer) items.left).intValue());
            mplew.writeInt(((Integer) items.right).intValue());
        }
        return mplew.getPacket();
    }

    public static byte[] showRewardItemAnimation(int itemId, String effect) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
        mplew.write(18);
        mplew.writeInt(itemId);
        mplew.write((effect != null) && (effect.length() > 0) ? 1 : 0);
        if ((effect != null) && (effect.length() > 0)) {
            mplew.writeMapleAsciiString(effect);
        }

        return mplew.getPacket();
    }

    public static byte[] showRewardItemAnimation(int itemId, String effect, int from_playerid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_FOREIGN_EFFECT.getValue());
        mplew.writeInt(from_playerid);
        mplew.write(17);
        mplew.writeInt(itemId);
        mplew.write((effect != null) && (effect.length() > 0) ? 1 : 0);
        if ((effect != null) && (effect.length() > 0)) {
            mplew.writeMapleAsciiString(effect);
        }

        return mplew.getPacket();
    }

    public static byte[] 物品出现在地图上(MapleMapItem drop, Point dropfrom, Point dropto, byte mod) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.DROP_ITEM_FROM_MAPOBJECT.getValue());
        mplew.write(0);//118+
        mplew.write(mod);  //这个数值
        mplew.writeInt(drop.getObjectId());
        mplew.write(drop.getMeso() > 0 ? 1 : 0);
        mplew.writeInt(0);//118+
        mplew.writeLong(Randomizer.nextInt(255));
        mplew.writeInt(drop.getItemId());
        mplew.writeInt(drop.getOwner());
        mplew.write(drop.getDropType());
        mplew.writePos(dropto);//坐标 X两位Y两位一共4位
        mplew.writeInt(0);

        if (mod != 2) {   //如果上面那个数值  不等于02 就写下面3个 
            mplew.writePos(dropfrom);
            mplew.write(0);
            mplew.writeInt(0);
        } else {
            mplew.write(0);
        }
        if (drop.getMeso() == 0) {
            PacketHelper.addExpirationTime(mplew, drop.getItem().getExpiration());
        }
        
        mplew.writeShort(drop.isPlayerDrop() ? 0 : 1);//这里有个判断是不是玩家丢的
        mplew.writeInt(0);//117+
        mplew.writeInt(0);
        mplew.write(0);//118+ 

        return mplew.getPacket();
    }

public static byte[] 玩家_出现在地图上(MapleCharacter chr) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPAWN_PLAYER.getValue());
        mplew.writeInt(chr.getId());
        mplew.write(chr.getLevel());
        mplew.writeMapleAsciiString(chr.getName());
        MapleQuestStatus ultExplorer = chr.getQuestNoAdd(MapleQuest.getInstance(111111));
        mplew.writeMapleAsciiString((ultExplorer != null && ultExplorer.getCustomData() != null) ? ultExplorer.getCustomData() : "");
        if (chr.getGuildId() <= 0) {
            mplew.writeInt(0);
            mplew.writeInt(0);
        } else {
            MapleGuild guild = Guild.getGuild(chr.getGuildId());
            if (guild != null) {
                mplew.writeMapleAsciiString(guild.getName());
                mplew.writeShort(guild.getLogoBG());
                mplew.write(guild.getLogoBGColor());
                mplew.writeShort(guild.getLogo());
                mplew.write(guild.getLogoColor());
            } else {
                mplew.writeInt(0);
                mplew.writeInt(0);
            }
        }
        mplew.writeShort(0);
        mplew.writeInt(0);//10周年标识
        mplew.writeInt(0);//119+
        mplew.writeInt(0);//名字前 老幺标识
        List<Pair> oldBuffValue = new ArrayList();
        List<Pair> newBuffValue = new ArrayList();
        int[] mask = new int[GameConstants.MAX_BUFFSTAT];
        mask[7]  |= 0x1800000;
        mask[10] |= 0x60;
        mask[12] |= 0x3FC0000;


        if (chr.getBuffedValue(MapleBuffStat.隐身术) != null || chr.isHidden()) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 隐身术");
            }
            mask[MapleBuffStat.隐身术.getPosition(true)] |= MapleBuffStat.隐身术.getValue();
        }
        if (chr.getBuffedValue(MapleBuffStat.无形箭弩) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 无形箭弩");
            }
            mask[MapleBuffStat.无形箭弩.getPosition(true)] |= MapleBuffStat.无形箭弩.getValue();
        }
        if (chr.getBuffedValue(MapleBuffStat.斗气集中) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 斗气集中");
            }
            mask[MapleBuffStat.斗气集中.getPosition(true)] |= MapleBuffStat.斗气集中.getValue();
            oldBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.斗气集中), 1));
        }
        if (chr.getBuffedValue(MapleBuffStat.属性攻击) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 属性攻击");
            }
            mask[MapleBuffStat.属性攻击.getPosition(true)] |= MapleBuffStat.属性攻击.getValue();
            oldBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.属性攻击), 2));
            oldBuffValue.add(new Pair(chr.getBuffSource(MapleBuffStat.属性攻击), 3));
        }
        if (chr.getBuffedValue(MapleBuffStat.影分身) != null && chr.getBuffSource(MapleBuffStat.影分身) != 15121004) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 影分身");
            }
            mask[MapleBuffStat.影分身.getPosition(true)] |= MapleBuffStat.影分身.getValue();
            oldBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.影分身), 2));
            oldBuffValue.add(new Pair(chr.getBuffSource(MapleBuffStat.影分身), 3));
        }

        if (chr.getBuffedValue(MapleBuffStat.变身术) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 变身术");
            }
            mask[MapleBuffStat.变身术.getPosition(true)] |= MapleBuffStat.变身术.getValue();
            oldBuffValue.add(new Pair(chr.getStatForBuff(MapleBuffStat.变身术).getMorph(chr), 2));
            oldBuffValue.add(new Pair(chr.getBuffSource(MapleBuffStat.变身术), 3));
        }
        if (chr.getBuffedValue(MapleBuffStat.金刚霸体) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 金刚霸体");
            }
            mask[MapleBuffStat.金刚霸体.getPosition(true)] |= MapleBuffStat.金刚霸体.getValue();
        }
        if (chr.getBuffedValue(MapleBuffStat.狂暴战魂) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 狂暴战魂");
            }
            mask[MapleBuffStat.狂暴战魂.getPosition(true)] |= MapleBuffStat.狂暴战魂.getValue();
        }
        if (((chr.getBuffedValue(MapleBuffStat.风影漫步) != null) && (ServerProperties.ShowPacket()))) {
            System.err.println("出现: 风影漫步");
        }
        if (chr.getBuffedValue(MapleBuffStat.PYRAMID_PQ) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: PYRAMID_PQ");
            }
            mask[MapleBuffStat.PYRAMID_PQ.getPosition(true)] |= MapleBuffStat.PYRAMID_PQ.getValue();
            oldBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.PYRAMID_PQ), 2));
            oldBuffValue.add(new Pair(chr.getTrueBuffSource(MapleBuffStat.PYRAMID_PQ), 3));
        }
        if (chr.getBuffedValue(MapleBuffStat.飞行骑乘) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 飞行骑乘");
            }
            mask[MapleBuffStat.飞行骑乘.getPosition(true)] |= MapleBuffStat.飞行骑乘.getValue();
        }
        if ((chr.getBuffedValue(MapleBuffStat.死亡猫头鹰) == null) && (chr.getBuffedValue(MapleBuffStat.终极斩) != null)) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 终极斩");
            }
            mask[MapleBuffStat.终极斩.getPosition(true)] |= MapleBuffStat.终极斩.getValue();
            oldBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.终极斩), 2));
            oldBuffValue.add(new Pair(chr.getTrueBuffSource(MapleBuffStat.终极斩), 3));
        }
        if (chr.getBuffedValue(MapleBuffStat.幻灵飓风) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 幻灵飓风");
            }
            mask[MapleBuffStat.幻灵飓风.getPosition(true)] |= MapleBuffStat.幻灵飓风.getValue();
            oldBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.幻灵飓风), 1));
        }
        if (chr.getBuffedValue(MapleBuffStat.潜入) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 潜入");
            }
            mask[MapleBuffStat.潜入.getPosition(true)] |= MapleBuffStat.潜入.getValue();
        }
        if (chr.getBuffedValue(MapleBuffStat.金属机甲) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 金属机甲");
            }
            mask[MapleBuffStat.金属机甲.getPosition(true)] |= MapleBuffStat.金属机甲.getValue();
            oldBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.金属机甲), 2));
            oldBuffValue.add(new Pair(chr.getTrueBuffSource(MapleBuffStat.金属机甲), 3));
        }
        if (chr.getBuffedValue(MapleBuffStat.黑暗灵气) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 黑暗灵气");
            }
            mask[MapleBuffStat.黑暗灵气.getPosition(true)] |= MapleBuffStat.黑暗灵气.getValue();
            oldBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.黑暗灵气), 2));
            oldBuffValue.add(new Pair(chr.getTrueBuffSource(MapleBuffStat.黑暗灵气), 3));
        }
        if (chr.getBuffedValue(MapleBuffStat.蓝色灵气) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 蓝色灵气");
            }
            mask[MapleBuffStat.蓝色灵气.getPosition(true)] |= MapleBuffStat.蓝色灵气.getValue();
            oldBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.蓝色灵气), 2));
            oldBuffValue.add(new Pair(chr.getTrueBuffSource(MapleBuffStat.蓝色灵气), 3));
        }
        if (chr.getBuffedValue(MapleBuffStat.黄色灵气) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 黄色灵气");
            }
            mask[MapleBuffStat.黄色灵气.getPosition(true)] |= MapleBuffStat.黄色灵气.getValue();
            oldBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.黄色灵气), 2));
            oldBuffValue.add(new Pair(chr.getTrueBuffSource(MapleBuffStat.黄色灵气), 3));
        }
        if (chr.getBuffedValue(MapleBuffStat.祝福护甲) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 祝福护甲");
            }
            mask[MapleBuffStat.祝福护甲.getPosition(true)] |= MapleBuffStat.祝福护甲.getValue();
        }
        if (chr.getBuffedValue(MapleBuffStat.GIANT_POTION) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: GIANT_POTION");
            }
            mask[MapleBuffStat.GIANT_POTION.getPosition(true)] |= MapleBuffStat.GIANT_POTION.getValue();
            oldBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.GIANT_POTION), 2));
            oldBuffValue.add(new Pair(chr.getTrueBuffSource(MapleBuffStat.GIANT_POTION), 3));
        }
        if (chr.getBuffedValue(MapleBuffStat.暴走形态) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 暴走形态");
            }
            mask[MapleBuffStat.暴走形态.getPosition(true)] |= MapleBuffStat.暴走形态.getValue();
        }

        if (chr.getBuffedValue(MapleBuffStat.神圣魔法盾) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 神圣魔法盾");
            }
            mask[MapleBuffStat.神圣魔法盾.getPosition(true)] |= MapleBuffStat.神圣魔法盾.getValue();
        }
        if (((chr.getBuffedValue(MapleBuffStat.黑暗变形) != null) && (ServerProperties.ShowPacket()))) {
            System.err.println("出现: 黑暗变形");
        }
        if (((chr.getBuffedValue(MapleBuffStat.精神注入) != null) && (ServerProperties.ShowPacket()))) {
            System.err.println("出现: 精神注入");
        }
                if (((chr.getBuffedValue(MapleBuffStat.精神连接) != null) && (ServerProperties.ShowPacket()))) {
            System.err.println("出现: 精神连接");
        }
        if (chr.getBuffedValue(MapleBuffStat.FAMILIAR_SHADOW) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: FAMILIAR_SHADOW");
            }
            mask[MapleBuffStat.FAMILIAR_SHADOW.getPosition(true)] |= MapleBuffStat.FAMILIAR_SHADOW.getValue();
            oldBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.FAMILIAR_SHADOW), 3));
            oldBuffValue.add(new Pair(chr.getStatForBuff(MapleBuffStat.FAMILIAR_SHADOW).getCharColor(), 3));
        }
        if (chr.getBuffedValue(MapleBuffStat.连环吸血) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 连环吸血");
            }
            mask[MapleBuffStat.连环吸血.getPosition(true)] |= MapleBuffStat.连环吸血.getValue();
            newBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.连环吸血), 2));
            newBuffValue.add(new Pair(chr.getBuffSource(MapleBuffStat.连环吸血), 3));
        }
        if (chr.getBuffedValue(MapleBuffStat.尖兵双重防御_回避率) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 尖兵双重防御_回避率");
            }
            mask[MapleBuffStat.尖兵双重防御_回避率.getPosition(true)] |= MapleBuffStat.尖兵双重防御_回避率.getValue();
            newBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.尖兵双重防御_回避率), 2));
        }
        Item weapon = chr.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -11);
        if ((chr.getBuffedValue(MapleBuffStat.狂龙剑壁之刃) != null) && (weapon != null)) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 狂龙剑壁之刃");
            }
            mask[MapleBuffStat.狂龙剑壁之刃.getPosition(true)] |= MapleBuffStat.狂龙剑壁之刃.getValue();
        }
        if (chr.尖兵能量() > 0) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 尖兵能量");
            }
            mask[MapleBuffStat.能量获得.getPosition(true)] |= MapleBuffStat.能量获得.getValue();
            newBuffValue.add(new Pair(chr.尖兵能量(), 1));
        }
        if (chr.getBuffedValue(MapleBuffStat.尖兵自由飞翔) != null) {
            if ((ServerProperties.ShowPacket())) {
                System.err.println("出现: 尖兵飞行");
            }
            mask[MapleBuffStat.尖兵自由飞翔.getPosition(true)] |= MapleBuffStat.尖兵自由飞翔.getValue();
            newBuffValue.add(new Pair(chr.getBuffedValue(MapleBuffStat.尖兵自由飞翔), 2));
            newBuffValue.add(new Pair(chr.getTrueBuffSource(MapleBuffStat.尖兵自由飞翔), 3));
        }
        for (int i = 0; i < mask.length; i++) {
            mplew.writeInt(mask[i]);
        }
//        mplew.write(HexTool.getByteArrayFromHexString("FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 C5 02 00 00 00 00 00 00 00 00 00 00 01 C5 02 00 00 00 00 00 00 00 00 00 00 00 00 01 C5 02 00 00 00 00 00 00 00 00 00 00 00 00 01 C5 02 00 00 00 00 00 00 00 00 00 00 01 C5 02 00 00 00 86 48 48 D2 00 00 00 00 00 00 00 00 00 00 01 C5 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 C5 02 00 00 00 00 00 00 00 00 00 00 00 00 01 C5 02 00 00 00 00 00 00 00 00 B2 4F 00 00 00 00 00 00 00 4E 75 00 00 05 86 DE 0F 00 06 A2 2C 10 00 07 85 5B 10 00 0B 04 05 14 00 FF FF FF 00 00 00 00 04 05 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 57 00 BB 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF FF 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00"));

 /*       for (Pair i : oldBuffValue) {
            switch ((Integer) i.right) {
                case 1:
                    mplew.write(((Integer) i.left).byteValue());
                    break;
                case 2:
                    mplew.writeShort(((Integer) i.left).shortValue());
                    break;
                case 3:
                    mplew.writeInt(((Integer) i.left).intValue());
                    break;
            }
        }*/
        mplew.writeInt(-1);
        mplew.write(0);
        //mplew.write(Math.min(chr.getBuffedValue(MapleBuffStat.ANGEL_ATK), 5));
       /* for (Pair i : newBuffValue) {
            switch ((Integer) i.right) {
                case 1:
                    mplew.write(((Integer) i.left).byteValue());
                    break;
                case 2:
                    mplew.writeShort(((Integer) i.left).shortValue());
                    break;
                case 3:
                    mplew.writeInt(((Integer) i.left).intValue());
                    break;
            }
        }*/
        if ((chr.getBuffedValue(MapleBuffStat.狂龙剑壁之刃) != null) && (weapon != null)) {
            Equip skin = (Equip) weapon;
            int itemId = skin.getItemId() % 10000 > 0 ? skin.getItemId() : weapon.getItemId();
            int buffid = chr.getTrueBuffSource(MapleBuffStat.狂龙剑壁之刃);
            mplew.writeShort(chr.getBuffedValue(MapleBuffStat.狂龙剑壁之刃));
            mplew.writeInt(buffid);
            mplew.writeZeroBytes(17);
            mplew.writeInt(buffid == 61101002 ? 1 : 2);
            mplew.writeInt(buffid == 61101002 ? 3 : 5);
            mplew.writeInt(itemId);
            mplew.writeInt(buffid == 61101002 ? 3 : 5);
            mplew.writeZeroBytes(buffid == 61101002 ? 5 : 13);
        } else {
            mplew.writeZeroBytes(26);
        }
        mplew.writeZeroBytes(7);
        int energybuff = chr.getBuffSource(MapleBuffStat.能量获得);
        if ((ServerProperties.ShowPacket())) {
            System.err.println(new StringBuilder().append("energybuff: ").append(energybuff).toString());
        }
        if (energybuff > 0) {
            mplew.writeInt(chr.尖兵能量电池状态() ? energybuff : 0);
            mplew.writeLong(Math.min(chr.尖兵能量电池剩余时间(), 10000));
        } else {
            mplew.writeZeroBytes(12);
        }
        int CHAR_MAGIC_SPAWN = Randomizer.nextInt();
        mplew.write(1);
        mplew.writeInt(CHAR_MAGIC_SPAWN); //1
        mplew.writeZeroBytes(8);
        mplew.write(1);
        mplew.writeInt(CHAR_MAGIC_SPAWN); //2
        mplew.writeZeroBytes(10);
        mplew.write(1);
        mplew.writeInt(CHAR_MAGIC_SPAWN); //3
        mplew.writeShort(0);
        int buffSrc = chr.getBuffSource(MapleBuffStat.骑兽技能);
        if ((ServerProperties.ShowPacket())) {
            System.err.println(new StringBuilder().append("buffSrc: ").append(buffSrc).toString());
        }
        if (buffSrc > 0) {
            Item c_mount = chr.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -123);
            Item mount = chr.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -18);
            if ((GameConstants.getMountItem(buffSrc, chr) == 0) && (c_mount != null) && (chr.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -124) != null)) {
                mplew.writeInt(c_mount.getItemId());
            } else if ((GameConstants.getMountItem(buffSrc, chr) == 0) && (mount != null) && (chr.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -19) != null)) {
                mplew.writeInt(mount.getItemId());
            } else {
                mplew.writeInt(GameConstants.getMountItem(buffSrc, chr));
            }

            mplew.writeInt(buffSrc);
        } else if (buffSrc > 0) {
            int 骑宠技能id = chr.get新式骑宠ID();
            int 类型 = GameConstants.新式骑宠外形(骑宠技能id);
            if (buffSrc != 0) {
                mplew.writeInt(类型);
                mplew.writeInt(骑宠技能id);
            } else {
                mplew.writeLong(0L);
            }
        } else {
            mplew.writeLong(0L);
        }
        mplew.write(1);
        mplew.writeInt(CHAR_MAGIC_SPAWN); //4
        mplew.writeZeroBytes(8);
        mplew.write(1);
        mplew.writeInt(CHAR_MAGIC_SPAWN); //5
        mplew.write(1);
        mplew.writeInt(Randomizer.nextInt());
        mplew.writeZeroBytes(10);
        mplew.write(1);
        mplew.writeInt(CHAR_MAGIC_SPAWN); //6
        mplew.writeZeroBytes(16);
        mplew.write(1);
        mplew.writeInt(CHAR_MAGIC_SPAWN); //7
        mplew.writeZeroBytes(10);
        mplew.write(1);
        mplew.writeInt(CHAR_MAGIC_SPAWN); //8
        if (chr.getBuffedValue(MapleBuffStat.尖兵自由飞翔) != null) {
            mplew.writeZeroBytes(4);
        }
        mplew.writeShort(chr.getJob());
        mplew.writeShort(chr.getSubcategory());
        PacketHelper.addCharLook(mplew, chr, true, false, true);
        if (GameConstants.is神之子(chr.getJob())) {
            PacketHelper.addCharLook(mplew, chr, true, false, true);
        }

        mplew.writeInt(0);
        mplew.writeInt(0);
        if ((chr.getBuffedValue(MapleBuffStat.飞行骑乘) != null) && (buffSrc > 0)) {
            PacketHelper.addCharLook(mplew, chr, true, false, true);
            mplew.writeInt(chr.getId());
        } else {
            mplew.writeLong(0L);
        }
        mplew.writeInt(0);
        mplew.writeInt(Math.min(250, chr.getInventory(MapleInventoryType.CASH).countById(5110000)));
        mplew.writeInt(chr.getItemEffect());
        mplew.writeInt(0);

        mplew.writeInt(chr.getTitleEffect());
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(chr.getItemEffect());//物品效果
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(-1);
        mplew.write(0);
        //mplew.writeInt(GameConstants.getInventoryType(chr.getChair()) == MapleInventoryType.SETUP ? chr.getChair() : 0);
        mplew.writeShort(-1);
        mplew.writeShort(0);
        mplew.writeInt(0);
        mplew.writeInt(0); //v117+
        mplew.writeShort(0);
        mplew.writePos(chr.getTruePosition());
        mplew.write(chr.getStance());
        mplew.writeShort(0);
        for (MaplePet pet : chr.getPets()) {
            if (pet.getSummoned()) {
                PetPacket.addPetInfo(mplew, chr, pet, true);
            }
        }
        mplew.write(0);
        mplew.writeInt(chr.getMount() != null ? chr.getMount().getLevel() : 1); // 骑宠等级 默认是1级
        mplew.writeInt(chr.getMount() != null ? chr.getMount().getExp() : 0);
        mplew.writeInt(chr.getMount() != null ? chr.getMount().getFatigue() : 0);
        PacketHelper.addAnnounceBox(mplew, chr);
        mplew.write((chr.getChalkboard() != null) && (chr.getChalkboard().length() > 0) ? 1 : 0);
        if ((chr.getChalkboard() != null) && (chr.getChalkboard().length() > 0)) {
            mplew.writeMapleAsciiString(chr.getChalkboard());
        }
        Triple rings = chr.getRings(false);
        addRingInfo(mplew, (List) rings.getLeft());
        addRingInfo(mplew, (List) rings.getMid());
        addMRingInfo(mplew, (List) rings.getRight(), chr);
        mplew.write(0);
        mplew.write(chr.getStat().Berserk ? 1 : 0);
        mplew.writeInt(chr.getMount().getItemId());//骑宠id
        mplew.writeZeroBytes(5);
        if (GameConstants.is狂龙(chr.getJob())) {
            mplew.writeZeroBytes(9);
        }
        for (int i = 0; i < 5; i++) {
            mplew.write(-1);
        }
        mplew.writeInt(0);
        mplew.write(1);
        mplew.write(0);//119+
        boolean pvp = chr.inPVP();
        if (pvp) {
            mplew.write(Integer.parseInt(chr.getEventInstance().getProperty("type")));
        }
        if (chr.getCarnivalParty() != null) {
            mplew.write(chr.getCarnivalParty().getTeam());
        } else if (GameConstants.isTeamMap(chr.getMapId())) {
            mplew.write(chr.getTeam() + (pvp ? 1 : 0));
        }
        mplew.writeInt(0);
        if (GameConstants.is林之灵(chr.getJob())) {
            mplew.writeZeroBytes(8);
        }
        mplew.writeLong(0); //v116
        mplew.writeLong(0); //120+
        mplew.writeShort(0);//120+

        return mplew.getPacket();
    }

    public static byte[] 玩家_消失在地图上(int cid) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.REMOVE_PLAYER_FROM_MAP.getValue());
        mplew.writeInt(cid);

        return mplew.getPacket();
    }

    public static byte[] facialExpression(MapleCharacter from, int expression) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.FACIAL_EXPRESSION.getValue());
        mplew.writeInt(from.getId());
        mplew.writeInt(expression);
        mplew.writeInt(-1);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] 玩家_移动(int cid, List<LifeMovementFragment> moves, Point startPos) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MOVE_PLAYER.getValue());
        mplew.writeInt(cid);
        mplew.writeInt(0);
        mplew.writePos(startPos);

        mplew.writeInt(0);
        PacketHelper.serializeMovementList(mplew, moves);

        return mplew.getPacket();
    }

    public static byte[] 召唤兽_移动(int cid, int oid, Point startPos, List<LifeMovementFragment> moves) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MOVE_SUMMON.getValue());
        mplew.writeInt(cid);
        mplew.writeInt(oid);
        mplew.writeInt(0);
        mplew.writePos(startPos);
        mplew.writeInt(0);
        PacketHelper.serializeMovementList(mplew, moves);

        return mplew.getPacket();
    }

    public static byte[] 召唤兽_攻击(int cid, int summonSkillId, byte animation, List<Pair<Integer, Integer>> allDamage, int level, boolean darkFlare) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SUMMON_ATTACK.getValue());
        mplew.writeInt(cid);
        mplew.writeInt(summonSkillId);
        mplew.write(level - 1);
        mplew.write(animation);
        mplew.write(allDamage.size());

        for (Pair attackEntry : allDamage) {
            mplew.writeInt(((Integer) attackEntry.left).intValue());
            mplew.write(7);
            mplew.writeInt(((Integer) attackEntry.right).intValue());
        }
        mplew.write(darkFlare ? 1 : 0);
        return mplew.getPacket();
    }

    public static byte[] closeRangeAttack(int cid, int tbyte, int skill, int level, int display, byte speed, List<AttackPair> damage, boolean energy, int lvl, byte mastery, byte unk, int charge) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(energy ? SendPacketOpcode.ENERGY_ATTACK.getValue() : SendPacketOpcode.CLOSE_RANGE_ATTACK.getValue());
        mplew.writeInt(cid);
        mplew.write(0);
        mplew.write(tbyte);
        mplew.write(lvl);
        if (skill > 0) {
            mplew.write(level);
            mplew.writeInt(skill);
        } else {
            mplew.write(0);
        }

        if (GameConstants.is神之子技能(skill)) {
            mplew.write(0);
        } else{
            mplew.write(0);
        }
        mplew.write(unk);
        mplew.writeShort(display);
        mplew.write(speed);
        mplew.write(mastery);
        mplew.writeInt(0);
        mplew.writeInt(0);
            for (AttackPair oned : damage) {
                if (oned.attack != null) {
                    mplew.writeInt(oned.objectid);
                    mplew.write(7);
                    mplew.writeShort(0);
                    mplew.write(oned.attack.size());
                    for (Pair eachd : oned.attack) {
                        mplew.writeInt(((Integer) eachd.left).intValue());
                    }
                }
            }
        if (skill == 4211006) {
            for (AttackPair oned : damage) {
                if (oned.attack != null) {
                    mplew.writeInt(oned.objectid);
                    mplew.write(7);
                    mplew.writeShort(0);
                    mplew.write(oned.attack.size());
                    for (Pair eachd : oned.attack) {
                        mplew.writeInt(((Integer) eachd.left).intValue());
                    }
                }
            }
        } else {
            for (AttackPair oned : damage) {
                if (oned.attack != null) {
                    mplew.writeInt(oned.objectid);
                    mplew.write(7);
                    mplew.writeShort(0);
                    for (Pair eachd : oned.attack) {
                        if (((Boolean) eachd.right).booleanValue()) {
                            mplew.writeInt(((Integer) eachd.left).intValue() + -2147483648);
                        } else {
                            mplew.writeInt(((Integer) eachd.left).intValue());
                        }
                    }
                }

            }

        }

        return mplew.getPacket();
    }

    public static byte[] 魂骑士攻击反馈(int 动作技能, int 动作技能lv, int cid, int tbyte, int skill, int level, int display, byte speed, List<AttackPair> damage, boolean energy, int lvl, byte mastery, byte unk, int charge) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(energy ? SendPacketOpcode.ENERGY_ATTACK.getValue() : SendPacketOpcode.CLOSE_RANGE_ATTACK.getValue());
        mplew.writeInt(cid);
        mplew.write(tbyte);
        mplew.write(lvl);
        if (skill > 0) {
            mplew.write(level);
            mplew.writeInt(skill);
        } else {
            mplew.write(0);
        }

        mplew.write(0);
        mplew.write(unk);

        mplew.writeInt(动作技能);
        mplew.writeInt(动作技能lv);

        mplew.writeShort(display);
        mplew.write(speed);
        mplew.write(mastery);
        mplew.writeInt(0);
       /* mplew.writeInt(cid);
        mplew.write(0);
        mplew.write(tbyte);
        mplew.write(lvl);
        if (skill > 0) {
            mplew.write(level);
            mplew.writeInt(skill);
        } else {
            mplew.write(0);
        }

        if (GameConstants.is神之子技能(skill)) {
            mplew.write(0);
        } else{
            mplew.write(0);
        }
        mplew.write(unk);
        mplew.writeShort(display);
        mplew.write(speed);
        mplew.write(mastery);
        mplew.writeInt(0);
        mplew.writeInt(0);*/

        for (AttackPair oned : damage) {
            if (oned.attack != null) {
                mplew.writeInt(oned.objectid);
                mplew.write(7);
                mplew.writeShort(0);
                for (Pair eachd : oned.attack) {
                    if (((Boolean) eachd.right).booleanValue()) {
                        mplew.writeInt(((Integer) eachd.left).intValue() + -2147483648);
                    } else {
                        mplew.writeInt(((Integer) eachd.left).intValue());
                    }
                }
            }
        }

        return mplew.getPacket();
    }

    public static byte[] strafeAttack(int cid, byte tbyte, int skill, int level, int display, byte speed, int itemid, List<AttackPair> damage, Point pos, int lvl, byte mastery, byte unk, int ultLevel) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.RANGED_ATTACK.getValue());
        /*mplew.writeInt(cid);
        mplew.write(tbyte);
        mplew.write(lvl);
        if (skill > 0) {
            mplew.write(level);
            mplew.writeInt(skill);
        } else {
            mplew.write(0);
        }
        mplew.write(ultLevel);
        if (ultLevel > 0) {
            mplew.writeInt(3220010);
        }
        mplew.write(0);
        mplew.writeShort(display);
        mplew.write(speed);
        mplew.write(mastery);
        mplew.writeInt(itemid);

        for (AttackPair oned : damage) {
            if (oned.attack != null) {
                mplew.writeInt(oned.objectid);
                mplew.write(7);
                mplew.writeShort(0);
                for (Pair eachd : oned.attack) {
                    if (((Boolean) eachd.right).booleanValue()) {
                        mplew.writeInt(((Integer) eachd.left).intValue() + -2147483648);
                    } else {
                        mplew.writeInt(((Integer) eachd.left).intValue());
                    }
                }
            }
        }
        mplew.writePos(pos);*/
        mplew.writeLong(0);

        return mplew.getPacket();
    }

    public static byte[] rangedAttack(int cid, byte tbyte, int skill, int level, int display, byte speed, int itemid, List<AttackPair> damage, Point pos, int lvl, byte mastery, byte unk) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.RANGED_ATTACK.getValue());
        /*mplew.writeInt(cid);
        mplew.write(tbyte);
        mplew.write(lvl);
        if (skill > 0) {
            mplew.write(level);
            mplew.writeInt(skill);
        } else {
            mplew.write(0);
        }

        if (GameConstants.is神之子技能(skill)) {
            mplew.write(0);
        }

        mplew.write(0);
        mplew.write(unk);
        mplew.writeShort(display);
        mplew.write(speed);
        mplew.write(mastery);
        mplew.writeInt(itemid);

        for (AttackPair oned : damage) {
            if (oned.attack != null) {
                mplew.writeInt(oned.objectid);
                mplew.write(7);
                mplew.writeShort(0);
                for (Pair eachd : oned.attack) {
                    if (((Boolean) eachd.right).booleanValue()) {
                        mplew.writeInt(((Integer) eachd.left).intValue() + -2147483648);
                    } else {
                        mplew.writeInt(((Integer) eachd.left).intValue());
                    }
                }
            }
        }
        mplew.writePos(pos);
        if (skill == 13121052) {
            mplew.writeInt(76);
            mplew.writeInt(-2);
        } else if (skill == 101000202) {
            mplew.writeInt(161);
        }*/
        mplew.writeLong(0);

        return mplew.getPacket();
    }

    public static byte[] magicAttack(int cid, int tbyte, int skill, int level, int display, byte speed, List<AttackPair> damage, int charge, int lvl, byte unk) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MAGIC_ATTACK.getValue());
        mplew.writeInt(cid);
        mplew.write(tbyte);
        mplew.write(lvl);
        mplew.write(level);
        mplew.writeInt(skill);

        mplew.write(0);
        mplew.write(unk);
        mplew.writeShort(display);
        mplew.write(speed);
        mplew.write(0);
        mplew.writeInt(0);

        for (AttackPair oned : damage) {
            if (oned.attack != null) {
                mplew.writeInt(oned.objectid);
                mplew.write(7);
                mplew.writeShort(0);
                for (Pair eachd : oned.attack) {
                    if (((Boolean) eachd.right).booleanValue()) {
                        mplew.writeInt(((Integer) eachd.left).intValue() + -2147483648);
                    } else {
                        mplew.writeInt(((Integer) eachd.left).intValue());
                    }
                }
            }
        }
        if (charge > 0) {
            mplew.writeInt(charge);
        }
        return mplew.getPacket();
    }

    public static byte[] NPC商店_获取(int sid, MapleShop shop, MapleClient c) {
        if (ServerProperties.ShowPacket()) {
            log.info("调用: " + new java.lang.Throwable().getStackTrace()[0]);
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.OPEN_NPC_SHOP.getValue());
        mplew.writeInt(0);
        mplew.write(0); //117+
        mplew.writeInt(sid);//NPC ID
        PacketHelper.addShopInfo(mplew, shop, c);
        return mplew.getPacket();
    }

    public static byte[] NPC商店_行为(byte code, MapleShop shop, MapleClient c, int indexBought) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CONFIRM_SHOP_TRANSACTION.getValue());

        mplew.write(code);
        /*
        if (code == 5) {
            mplew.writeInt(0);
            mplew.writeInt(shop.getNpcId());
            PacketHelper.addShopInfo(mplew, shop, c);
        } else {
            mplew.write(indexBought >= 0 ? 1 : 0);
            if (indexBought >= 0) {
                mplew.writeInt(indexBought);
            }
            mplew.write(0);
        }*/
        switch (code) {
            case 18://充值金币不够
            case 6://背包空间不够OK
                mplew.write(indexBought >= 0 ? 1 : 0);
                if (indexBought >= 0) {
                    mplew.writeInt(indexBought);
                } else {
                    mplew.write(0);
                }
                break;
            case 7://卖出道具完成OK
            case 8://购买道具完成OK
                mplew.writeInt(shop.getShopItemId());
                //mplew.writeInt(0);
                mplew.writeInt(shop.getNpcId());
                PacketHelper.addShopInfo(mplew, shop, c);
                break;
            //case 7://卖出道具完成OK
            case 5://现在无法购买该道具
            case 29://购买回购出错
                break;
            case 0://充值飞镖完成
                mplew.write(0);
                mplew.write(0);
                break;
            default:
                System.err.println("未知的商店操作: " + code);
        }
        
        return mplew.getPacket();
    }

    public static byte[] addInventorySlot(MapleInventoryType type, Item item) {
        return addInventorySlot(type, item, false);
    }

    public static byte[] addInventorySlot(MapleInventoryType type, Item item, boolean fromDrop) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(fromDrop ? 1 : 0);
        mplew.writeShort(1);
        mplew.write((item.getPosition() > 100) && (type == MapleInventoryType.ETC) ? 9 : 0);
        mplew.write(type.getType());
        mplew.write(item.getPosition());
        PacketHelper.addItemInfo(mplew, item, true, false);
        //mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] updateInventorySlot(MapleInventoryType type, Item item, boolean fromDrop) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(fromDrop ? 1 : 0);
        mplew.writeShort(1);
        mplew.write((item.getPosition() > 100) && (type == MapleInventoryType.ETC) ? 6 : 1);
        mplew.write(type.getType());
        mplew.writeShort(item.getPosition());
        mplew.writeShort(item.getQuantity());

        return mplew.getPacket();
    }

    public static byte[] moveInventoryItem(MapleInventoryType type, short src, short dst, boolean bag, boolean bothBag) {
        return moveInventoryItem(type, src, dst, (short) -1, bag, bothBag);
    }

    public static byte[] moveInventoryItem(MapleInventoryType type, short src, short dst, short equipIndicator, boolean bag, boolean bothBag) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(HexTool.getByteArrayFromHexString("01 01 00"));
        mplew.write(bothBag ? 8 : bag ? 5 : 2);
        mplew.write(type.getType());
        mplew.writeShort(src);
        mplew.writeShort(dst);
        if (equipIndicator != -1) {
            mplew.write(equipIndicator);
        }
        if (bag) {
            mplew.write(0);
        }

        return mplew.getPacket();
    }

    public static byte[] 整理背包物品(MapleInventoryType type, short src, short dst, short total, boolean bag, boolean switchSrcDst, boolean bothBag) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(HexTool.getByteArrayFromHexString("01 02 00"));
        mplew.write((bag) && ((switchSrcDst) || (bothBag)) ? 7 : 3);
        mplew.write(type.getType());
        mplew.writeShort(src);
        mplew.write((bag) && ((!switchSrcDst) || (bothBag)) ? 6 : 1);
        mplew.write(type.getType());
        mplew.writeShort(dst);
        mplew.writeShort(total);

        return mplew.getPacket();
    }

    public static byte[] moveAndMergeWithRestInventoryItem(MapleInventoryType type, short src, short dst, short srcQ, short dstQ, boolean bag, boolean switchSrcDst, boolean bothBag) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(HexTool.getByteArrayFromHexString("01 02 00"));
        mplew.write((bag) && ((switchSrcDst) || (bothBag)) ? 6 : 1);
        mplew.write(type.getType());
        mplew.writeShort(src);
        mplew.writeShort(srcQ);
        mplew.write((bag) && ((!switchSrcDst) || (bothBag)) ? 6 : 1);
        mplew.write(type.getType());
        mplew.writeShort(dst);
        mplew.writeShort(dstQ);

        return mplew.getPacket();
    }

    public static byte[] clearInventoryItem(MapleInventoryType type, short slot, boolean fromDrop) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(fromDrop ? 1 : 0);
        mplew.writeShort(1);
        mplew.write((slot > 100) && (type == MapleInventoryType.ETC) ? 7 : 3);
        mplew.write(type.getType());
        mplew.writeShort(slot);

        return mplew.getPacket();
    }

    public static byte[] updateSpecialItemUse(Item item, byte invType, MapleCharacter chr) {
        return updateSpecialItemUse(item, invType, item.getPosition(), false, chr);
    }

    public static byte[] updateSpecialItemUse(Item item, byte invType, short pos, boolean theShort, MapleCharacter chr) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(0);
        mplew.writeShort(2);

        mplew.write((invType == MapleInventoryType.ETC.getType()) && (pos > 100) ? 7 : 3);
        mplew.write(invType);
        mplew.writeShort(pos);
        mplew.write(0);
        mplew.write(invType);
        if ((item.getType() == 1) || (theShort)) {
            mplew.writeShort(pos);
        } else {
            mplew.write(pos);
        }
        PacketHelper.addItemInfo(mplew, item, true, true, false, false, chr);
        if (pos < 0) {
            mplew.write(2);
        }

        return mplew.getPacket();
    }

    public static byte[] updateSpecialItemUse_(Item item, byte invType, MapleCharacter chr) {
        return updateSpecialItemUse_(item, invType, item.getPosition(), chr);
    }

    public static byte[] updateSpecialItemUse_(Item item, byte invType, short pos, MapleCharacter chr) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(0);
        mplew.writeShort(1);
        mplew.write(0);
        mplew.write(invType);
        if (item.getType() == 1) {
            mplew.writeShort(pos);
        } else {
            mplew.write(pos);
        }
        PacketHelper.addItemInfo(mplew, item, true, true, false, false, chr);
        if (pos < 0) {
            mplew.write(1);
        }

        return mplew.getPacket();
    }

    public static byte[] scrolledItem(Item scroll, Item item, boolean destroyed, boolean potential) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(1);
        mplew.writeShort(destroyed ? 2 : 3);
        mplew.write(scroll.getQuantity() > 0 ? 1 : 3);
        mplew.write(GameConstants.getInventoryType(scroll.getItemId()).getType());
        mplew.writeShort(scroll.getPosition());

        if (scroll.getQuantity() > 0) {
            mplew.writeShort(scroll.getQuantity());
        }

        mplew.write(3);

        if (!destroyed) {
            mplew.write(MapleInventoryType.EQUIP.getType());
            mplew.writeShort(item.getPosition());
            mplew.write(0);
        }

        mplew.write(MapleInventoryType.EQUIP.getType());
        mplew.writeShort(item.getPosition());
        if (!destroyed) {
            PacketHelper.addItemInfo(mplew, item, true, true);
        }
        if (potential) {
            mplew.write(6);
        }

        return mplew.getPacket();
    }

    public static byte[] 更新_神之子_武器(Item item, boolean 阿尔法武器) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(0);
        mplew.writeShort(4);
        for (int i = 0; i <= 1; i++) {
            mplew.write(3);
            mplew.write(MapleInventoryType.EQUIP.getType());
            mplew.writeShort(item.getPosition());
            mplew.write(0);
            mplew.write(MapleInventoryType.EQUIP.getType());
            mplew.writeShort(item.getPosition());
            PacketHelper.addItemInfo(mplew, item, true, true);
        }

        mplew.write(阿尔法武器 ? 11 : 12);


        return mplew.getPacket();
    }

    public static byte[] moveAndUpgradeItem(MapleInventoryType type, Item item, short oldpos, short newpos, MapleCharacter chr) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(1);
        mplew.writeShort(3);
        mplew.write((type == MapleInventoryType.ETC) && (newpos > 100) ? 7 : 3);
        mplew.write(type.getType());
        mplew.writeShort(oldpos);
        mplew.write(0);
        mplew.write(1);
        mplew.writeShort(oldpos);
        PacketHelper.addItemInfo(mplew, item, true, true, false, false, chr);
        mplew.write(2);
        mplew.write(type.getType());
        mplew.writeShort(oldpos);
        mplew.writeShort(newpos);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] getScrollEffect(int chrId, int scroll, int toScroll) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_SCROLL_EFFECT.getValue());
        mplew.writeInt(chrId);
        mplew.writeShort(1);
        mplew.writeInt(scroll);
        mplew.writeInt(toScroll);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] getScrollEffect(int chrId, Equip.ScrollResult scrollSuccess, boolean legendarySpirit, boolean whiteScroll, int scroll, int toScroll) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_SCROLL_EFFECT.getValue());
        mplew.writeInt(chrId);
        if (scrollSuccess == Equip.ScrollResult.成功) {
            mplew.writeShort(1);
        } else if (scrollSuccess == Equip.ScrollResult.消失) {
            mplew.writeShort(2);
        } else {
            mplew.writeShort(0);
        }

        mplew.writeInt(scroll);
        mplew.writeInt(toScroll);
        mplew.write(legendarySpirit ? 1 : 0);
        if (whiteScroll) {
            mplew.write(whiteScroll ? 1 : 0);
        }
        return mplew.getPacket();
    }

    public static byte[] getPotentialEffect(int chrId, int itemid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_MAGNIFYING_EFFECT.getValue());
        mplew.writeInt(chrId);
        mplew.write(1);
        mplew.writeInt(itemid);
        return mplew.getPacket();
    }

    public static byte[] 放大镜效果(int chr, short pos) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_MAGNIFYING_EFFECT.getValue());
        mplew.writeInt(chr);
        mplew.writeShort(pos);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] 魔方光效(boolean fireworks, int chr, boolean success, int itemid) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_POTENTIAL_RESET.getValue());
        mplew.writeInt(chr);
        mplew.write(success ? 1 : 1);
        mplew.writeInt(itemid);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] 新砸卷对话框(boolean 成功) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        return mplew.getPacket();
    }

    public static byte[] 显示星岩效果(int chr, boolean success) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_NEBULITE_EFFECT.getValue());
        mplew.writeInt(chr);
        mplew.write(success ? 1 : 0);
        mplew.writeMapleAsciiString(success ? "镶嵌星岩成功." : "镶嵌星岩失败.");

        return mplew.getPacket();
    }

    public static byte[] useNebuliteFusion(int cid, int itemId, boolean success) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_FUSION_EFFECT.getValue());
        mplew.writeInt(cid);
        mplew.write(success ? 1 : 0);
        mplew.writeInt(itemId);

        return mplew.getPacket();
    }

    public static byte[] 物品制造_成功() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
        mplew.write(20);
        mplew.writeZeroBytes(4);

        return mplew.getPacket();
    }

    public static byte[] 物品制造_成功_3rdParty(int from_playerid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_FOREIGN_EFFECT.getValue());
        mplew.writeInt(from_playerid);
        mplew.write(20);
        mplew.writeZeroBytes(4);

        return mplew.getPacket();
    }

    public static byte[] explodeDrop(int oid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.REMOVE_ITEM_FROM_MAP.getValue());
        mplew.write(4);
        mplew.writeInt(oid);
        mplew.writeShort(655);

        return mplew.getPacket();
    }

    public static byte[] removeItemFromMap(int oid, int animation, int cid) {
        return 物品消失在地图上(oid, animation, cid, 0);
    }

    public static byte[] 物品消失在地图上(int oid, int animation, int cid, int slot) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.REMOVE_ITEM_FROM_MAP.getValue());
        mplew.write(animation);
        mplew.writeInt(oid);
        if (animation >= 2) {
            mplew.writeInt(cid);
            if (animation == 5) {
                mplew.writeInt(slot);
            }
        }
        return mplew.getPacket();
    }

    public static byte[] updateCharLook(MapleCharacter chr) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.UPDATE_CHAR_LOOK.getValue());
        mplew.writeInt(chr.getId());
        mplew.write(1);
        PacketHelper.addCharLook(mplew, chr, false, true, true);
        Triple rings = chr.getRings(false);
        addRingInfo(mplew, (List) rings.getLeft());
        addRingInfo(mplew, (List) rings.getMid());
        addMRingInfo(mplew, (List) rings.getRight(), chr);
        mplew.writeInt(0);
        return mplew.getPacket();
    }

    public static void addRingInfo(MaplePacketLittleEndianWriter mplew, List<MapleRing> rings) {
        mplew.write(rings.size());
        for (MapleRing ring : rings) {
            mplew.writeInt(1);
            mplew.writeLong(ring.getRingId());
            mplew.writeLong(ring.getPartnerRingId());
            mplew.writeInt(ring.getItemId());
        }
    }

    public static void addMRingInfo(MaplePacketLittleEndianWriter mplew, List<MapleRing> rings, MapleCharacter chr) {
        mplew.write(rings.size());
        for (MapleRing ring : rings) {
            mplew.writeInt(1);
            mplew.writeInt(chr.getId());
            mplew.writeInt(ring.getPartnerChrId());
            mplew.writeInt(ring.getItemId());
        }
    }

    public static byte[] dropInventoryItem(MapleInventoryType type, short src) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(HexTool.getByteArrayFromHexString("01 01 00 03"));
        mplew.write(type.getType());
        mplew.writeShort(src);
        if (src < 0) {
            mplew.write(1);
        }

        return mplew.getPacket();
    }

    public static byte[] dropInventoryItemUpdate(MapleInventoryType type, Item item) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(HexTool.getByteArrayFromHexString("01 01 00 01"));
        mplew.write(type.getType());
        mplew.writeShort(item.getPosition());
        mplew.writeShort(item.getQuantity());

        return mplew.getPacket();
    }

    public static byte[] 玩家受到伤害(int cid, int type, int damage, int monsteridfrom, byte direction, int skillid, int pDMG, boolean pPhysical, int pID, byte pType, Point pPos, byte offset, int offset_d, int fake) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.DAMAGE_PLAYER.getValue());
        mplew.writeInt(cid);
        mplew.write(type);
        mplew.writeInt(damage);
        mplew.write(0);
        if (type >= -1) {
            mplew.writeInt(monsteridfrom);
            mplew.write(direction);
            mplew.writeInt(skillid);
            mplew.writeInt(pDMG);
            mplew.write(0);
            if (pDMG > 0) {
                mplew.write(pPhysical ? 1 : 0);
                mplew.writeInt(pID);
                mplew.write(pType);
                mplew.writePos(pPos);
            }
            mplew.write(offset);
            if (offset == 1) {
                mplew.writeInt(offset_d);
            }
        }
        mplew.writeInt(damage);
        if ((damage <= 0) || (fake > 0)) {
            mplew.writeInt(fake);
        }
        return mplew.getPacket();
    }

    public static byte[] 更新任务(MapleQuestStatus quest) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(1);
        mplew.writeShort(quest.getQuest().getId());
        mplew.write(quest.getStatus());
        switch (quest.getStatus()) {
            case 0:
                mplew.writeZeroBytes(10);
                break;
            case 1:
                mplew.writeMapleAsciiString(quest.getCustomData() != null ? quest.getCustomData() : "");
                break;
            case 2:
                mplew.writeLong(PacketHelper.getTime(System.currentTimeMillis()));
        }

        return mplew.getPacket();
    }

    public static byte[] updateInfoQuest(int quest, String data) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(12);
        mplew.writeShort(quest);
        mplew.writeMapleAsciiString(data);

        return mplew.getPacket();
    }

    public static byte[] updateQuestInfo(MapleCharacter c, int quest, int npc, byte progress) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.UPDATE_QUEST_INFO.getValue());
        mplew.write(progress);
        mplew.writeShort(quest);
        mplew.writeInt(npc);
        mplew.writeShort(0);
        mplew.write(1);

        return mplew.getPacket();
    }

    public static byte[] updateQuestFinish(int quest, int npc, int nextquest) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.UPDATE_QUEST_INFO.getValue());
        mplew.write(11);
        mplew.writeShort(quest);
        mplew.writeInt(npc);
        mplew.writeShort(nextquest);
        mplew.write(1);
        return mplew.getPacket();
    }

    public static byte[] updateMedalQuestInfo(byte op, int itemId) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.UPDATE_MEDAL_QUEST.getValue());

        mplew.write(op);
        mplew.writeInt(itemId);

        return mplew.getPacket();
    }

    public static byte[] 角色信息(MapleCharacter chr, boolean isSelf) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CHAR_INFO.getValue());
        mplew.writeInt(chr.getId());
        mplew.write(chr.getLevel());
        mplew.writeInt(chr.getJob());
        mplew.write(chr.getStat().pvpRank);
        mplew.writeInt(chr.getFame());
        mplew.write(chr.getMarriageId() > 0 ? 1 : 0);

        List prof = chr.getProfessions();
        mplew.write(prof.size());
        for (Iterator i$ = prof.iterator(); i$.hasNext();) {
            int i = ((Integer) i$.next()).intValue();
            mplew.writeShort(i);
        }

        if (chr.getGuildId() <= 0) {
            mplew.writeMapleAsciiString("-");
            mplew.writeMapleAsciiString("");
        } else {
            MapleGuild gs = Guild.getGuild(chr.getGuildId());
            if (gs != null) {
                mplew.writeMapleAsciiString(gs.getName());
                if (gs.getAllianceId() > 0) {
                    MapleGuildAlliance allianceName = Alliance.getAlliance(gs.getAllianceId());
                    if (allianceName != null) {
                        mplew.writeMapleAsciiString(allianceName.getName());
                    } else {
                        mplew.writeMapleAsciiString("");
                    }
                } else {
                    mplew.writeMapleAsciiString("");
                }
            } else {
                mplew.writeMapleAsciiString("-");
                mplew.writeMapleAsciiString("");
            }
        }

        if (chr.getPet(0) == null) {
            mplew.write(-1);
            mplew.write(0);
        } else {
            mplew.write(-1);
            mplew.write(0);
        }

        mplew.write(chr.getPet(0) != null ? 1 : 0);
        for (MaplePet pet : chr.getPets()) {
            if (pet.getSummoned()) {
                mplew.write(1);
                mplew.writeInt(chr.getPetIndex(pet));
                mplew.writeInt(pet.getPetItemId());
                mplew.writeMapleAsciiString(pet.getName());
                mplew.write(pet.getLevel());
                mplew.writeShort(pet.getCloseness());
                mplew.write(pet.getFullness());
                mplew.writeShort(pet.getFlags());
                Item inv = chr.getInventory(MapleInventoryType.EQUIPPED).getItem((short) (byte) (chr.getPetIndex(pet) == 0 ? -114 : chr.getPetIndex(pet) == 1 ? -130 : -138));
                mplew.writeInt(inv == null ? 0 : inv.getItemId());
                mplew.writeInt(-1);
            }

        }

        mplew.write(0);

        int wishlistSize = chr.getWishlistSize();
        mplew.write(wishlistSize);
        if (wishlistSize > 0) {
            int[] wishlist = chr.getWishlist();
            for (int x = 0; x < wishlistSize; x++) {
                mplew.writeInt(wishlist[x]);
            }

        }

        Item medal = chr.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -26);
        mplew.writeInt(medal == null ? 0 : medal.getItemId());

        List<Pair<Integer, Long>> medalQuests = chr.getCompletedMedals();
        mplew.writeShort(medalQuests.size());
        for (Pair x : medalQuests) {
            mplew.writeShort(((Integer) x.left).intValue());
            mplew.writeLong(((Long) x.right).longValue());
        }

        for (MapleTrait.MapleTraitType t : MapleTrait.MapleTraitType.values()) {
            mplew.write(chr.getTrait(t).getLevel());
        }

        List chairs = new ArrayList();
        for (Item i : chr.getInventory(MapleInventoryType.SETUP).newList()) {
            if ((i.getItemId() / 10000 == 301) && (!chairs.contains(Integer.valueOf(i.getItemId())))) {
                chairs.add(Integer.valueOf(i.getItemId()));
            }
        }

        mplew.writeLong(0L);

        mplew.writeInt(chairs.size());
        for (Iterator i$ = chairs.iterator(); i$.hasNext();) {
            int i = ((Integer) i$.next()).intValue();
            mplew.writeInt(i);
        }

        List medals = new ArrayList();
        for (Item i : chr.getInventory(MapleInventoryType.EQUIP).list()) {
            if ((i.getItemId() >= 1142000) && (i.getItemId() < 1152000)) {
                medals.add(Integer.valueOf(i.getItemId()));
            }
        }

        mplew.writeInt(medals.size());
        for (Iterator i$ = medals.iterator(); i$.hasNext();) {
            int i = ((Integer) i$.next()).intValue();
            mplew.writeInt(i);
        }

        return mplew.getPacket();
    }

    public static byte[] giveDice(int buffid, int skillid, int duration, List<Pair<MapleBuffStat, Integer>> statups) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }

        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

        PacketHelper.writeBuffMask(mplew, statups);

        mplew.writeShort(Math.max(buffid / 100, Math.max(buffid / 10, buffid % 10)));

        mplew.writeInt(skillid);
        mplew.writeInt(duration);
        mplew.writeInt(0);
        mplew.write(0);

        mplew.writeInt(GameConstants.getDiceStat(buffid, 3));
        mplew.writeInt(GameConstants.getDiceStat(buffid, 3));
        mplew.writeInt(GameConstants.getDiceStat(buffid, 4));
        mplew.writeZeroBytes(20);
        mplew.writeInt(GameConstants.getDiceStat(buffid, 2));
        mplew.writeZeroBytes(12);
        mplew.writeInt(GameConstants.getDiceStat(buffid, 5));
        mplew.writeZeroBytes(16);
        mplew.writeInt(GameConstants.getDiceStat(buffid, 6));
        mplew.writeZeroBytes(20);
        mplew.writeInt(1000);
        mplew.writeInt(1);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] giveMount(int buffid, int skillid, List<Pair<MapleBuffStat, Integer>> statups) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (ServerProperties.IsLvkejian()) {
            String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 giveMount --2   \r\n").toString();
            SendTo = new StringBuilder().append(SendTo).append("buffid = ").append(buffid).append("     skillid = ").append(skillid).append("      statups =  ").append(statups.toString()).toString();

            FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
        }
        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        PacketHelper.writeBuffMask(mplew, statups);
        mplew.writeInt(0);
        mplew.write(0);
        mplew.writeInt(buffid);
        mplew.writeInt(skillid);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.write(0);
        mplew.write(1);
        mplew.write(63);
        mplew.writeInt(0);

        return mplew.getPacket();
    }

    

    public static byte[] 林之灵模式切换(MapleCharacter chr, List<Pair<MapleBuffStat, Integer>> statups, int bufflenth) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (ServerProperties.IsLvkejian()) {
            String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 林之灵模式切换   \r\n").toString();
            FileoutputUtil.packetLog("log\\林之灵模式切换.log", SendTo);
        }
        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        PacketHelper.writeBuffMask(mplew, statups);
        mplew.writeShort(20);
        mplew.writeInt(30020232);
        mplew.writeInt(-65245599);
        mplew.writeShort(1);
        mplew.writeInt(36121054);
        mplew.writeInt(bufflenth);
        mplew.writeZeroBytes(9);
        mplew.writeInt(1000);
        mplew.writeZeroBytes(5);

        return mplew.getPacket();
    }

    

    public static byte[] giveArcane(Map<Integer, Integer> statups, int duration) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (ServerProperties.IsLvkejian()) {
            String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 giveArcane --3   \r\n").toString();
            SendTo = new StringBuilder().append(SendTo).append("duration = ").append(duration).append("     statups =  ").append(statups.toString()).toString();

            FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
        }
        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        PacketHelper.writeSingleMask(mplew, MapleBuffStat.神秘瞄准术);

        mplew.writeShort(0);
        mplew.write(0);
        mplew.writeInt(statups.size());
        for (Map.Entry stat : statups.entrySet()) {
            mplew.writeInt(((Integer) stat.getKey()).intValue());
            mplew.writeLong(((Integer) stat.getValue()).intValue());
            mplew.writeInt(duration);
        }
        mplew.writeShort(0);
        mplew.writeShort(0);
        mplew.write(1);
        mplew.write(0);
        mplew.write(1);

        return mplew.getPacket();
    }

    public static byte[] givePirate(List<Pair<MapleBuffStat, Integer>> statups, int duration, int skillid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        boolean infusion = (skillid == 5821009) || (skillid == 15111005) || (skillid % 10000 == 8006);

        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (ServerProperties.IsLvkejian()) {
            String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 givePirate --4   \r\n").toString();
            SendTo = new StringBuilder().append(SendTo).append("skillid = ").append(skillid).append("      duration = ").append(duration).append("     statups =  ").append(statups.toString()).toString();

            FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
        }
        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        PacketHelper.writeBuffMask(mplew, statups);
        mplew.writeShort(0);
        mplew.write(0);
        for (Pair stat : statups) {
            mplew.writeInt(((Integer) stat.getRight()).intValue());
            mplew.writeLong(skillid);
            mplew.writeZeroBytes(infusion ? 6 : 1);
            mplew.writeShort(duration);
        }
        mplew.writeShort(0);
        mplew.writeShort(0);
        mplew.write(1);

        mplew.write(1);

        return mplew.getPacket();
    }

    public static byte[] giveForeignPirate(List<Pair<MapleBuffStat, Integer>> statups, int duration, int cid, int skillid) {
        boolean infusion = (skillid == 5821009) || (skillid == 15111005);
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_FOREIGN_BUFF.getValue());
        mplew.writeInt(cid);
        PacketHelper.writeBuffMask(mplew, statups);
        mplew.writeShort(0);
        mplew.write(0);
        for (Pair stat : statups) {
            mplew.writeInt(((Integer) stat.getRight()).intValue());
            mplew.writeLong(skillid);
            mplew.writeZeroBytes(infusion ? 6 : 1);
            mplew.writeShort(duration);
        }
        mplew.writeShort(0);
        mplew.writeShort(0);
        mplew.write(1);
        mplew.write(1);
        return mplew.getPacket();
    }

    public static byte[] giveHoming(int skillid, int mobid, int x) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (ServerProperties.IsLvkejian()) {
            String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 giveHoming --5   \r\n").toString();
            SendTo = new StringBuilder().append(SendTo).append("skillid = ").append(skillid).append("      mobid = ").append(mobid).append("     x =  ").append(x).toString();

            FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
        }
        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        PacketHelper.writeSingleMask(mplew, MapleBuffStat.导航辅助);
        mplew.writeShort(0);
        mplew.write(0);
        mplew.writeInt(1);
        mplew.writeLong(skillid);
        mplew.write(0);
        mplew.writeLong(mobid);
        mplew.writeShort(0);
        mplew.writeShort(0);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] giveEnergyChargeTest(int bar, int bufflength) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (ServerProperties.IsLvkejian()) {
            String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 giveEnergyChargeTest --6   \r\n").toString();
            SendTo = new StringBuilder().append(SendTo).append("bar = ").append(bar).append("      bufflength = ").append(bufflength).toString();

            FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
        }
        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        PacketHelper.writeSingleMask(mplew, MapleBuffStat.能量获得);
        mplew.writeShort(0);
        mplew.write(0);
        mplew.writeInt(Math.min(bar, 10000));
        mplew.writeLong(0L);
        mplew.writeShort(0);
        mplew.writeInt(bar >= 10000 ? bufflength : 0);
        mplew.write(4);

        return mplew.getPacket();
    }

    public static byte[] giveEnergyChargeTest(int cid, int bar, int bufflength) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_FOREIGN_BUFF.getValue());
        mplew.writeInt(cid);
        PacketHelper.writeSingleMask(mplew, MapleBuffStat.能量获得);
        mplew.writeShort(0);
        mplew.write(0);
        mplew.writeInt(Math.min(bar, 10000));
        mplew.writeLong(0L);
        mplew.writeShort(0);
        mplew.writeInt(bar >= 10000 ? bufflength : 0);
        return mplew.getPacket();
    }

    

    public static byte[] 狂龙终极变形(int buffid, int bufflength, List<Pair<MapleBuffStat, Integer>> statups) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (buffid == 61111008) {
            buffid = 61120008;
        }
        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

        PacketHelper.writeBuffMask(mplew, statups);

        for (Pair stat : statups) {
            if (((Integer) stat.getRight()).intValue() == 20) {
                mplew.writeShort(((Integer) stat.getRight()).intValue());
                mplew.writeInt(61121217);
                mplew.writeShort(24592);
                mplew.writeShort(64447);
                mplew.writeZeroBytes(5);
                mplew.writeInt(4);
                mplew.writeInt(5);
                mplew.writeInt(1402174);
                mplew.writeInt(5);
                mplew.writeLong(0L);
                mplew.writeLong(0L);
                mplew.writeLong(0L);
            } else {
                if (((MapleBuffStat) stat.getLeft()).canStack()) {
                    mplew.writeInt(1);
                    mplew.writeInt(buffid);
                    mplew.writeInt(((Integer) stat.getRight()).intValue());
                    mplew.writeInt(71344111);
                    mplew.writeInt(1);
                } else {
                    mplew.writeShort(((Integer) stat.getRight()).intValue());
                    mplew.writeInt(buffid);
                }
                mplew.writeInt(bufflength);
            }
        }
        mplew.writeInt(0);
        mplew.write(1);
        mplew.write(6);
        mplew.writeInt(0);
        ;
        return mplew.getPacket();
    }

    public static byte[] 狂龙剑壁之刃(int 武器ID, int 数量, int buffid, int bufflength, List<Pair<MapleBuffStat, Integer>> statups, MapleStatEffect effect) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        PacketHelper.writeBuffMask(mplew, statups);

        for (Pair stat : statups) {
            mplew.writeShort(((Integer) stat.getRight()).intValue());
            mplew.writeInt(buffid);
            mplew.writeInt(bufflength);
        }
        mplew.writeInt(0);
        mplew.write(0);
        mplew.writeInt(2);
        mplew.writeInt(数量);
        mplew.writeInt(武器ID);
        mplew.writeInt(数量);
        mplew.writeZeroBytes(28);
        mplew.writeInt(1);
        mplew.write(0);

        return mplew.getPacket();
    }

    

    public static byte[] 魂骑士日月转轮(int buffid, int bufflength, int 第二个BUFF, List<Pair<MapleBuffStat, Integer>> statups, MapleStatEffect effect) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

        PacketHelper.writeBuffMask(mplew, statups);
        if (第二个BUFF == 11121011) {
            mplew.writeShort(20);
            mplew.writeInt(第二个BUFF);
            mplew.writeInt(bufflength);
        }

        mplew.writeShort(1);
        mplew.writeInt(buffid);
        mplew.writeInt(bufflength);

        if (第二个BUFF == 11121011) {
            mplew.writeInt(0);
            mplew.write(5);
            mplew.writeInt(0);
            mplew.writeInt(1);
            mplew.writeInt(第二个BUFF);
            mplew.writeInt(20);
            mplew.writeInt(154734868);
            mplew.writeInt(0);
            mplew.writeInt(bufflength);
        } else {
            mplew.writeInt(0);
            mplew.write(5);
            mplew.writeInt(0);
            mplew.writeInt(1);
            mplew.writeInt(第二个BUFF);
            mplew.writeInt(-2);
            mplew.writeInt(154709286);
            mplew.writeInt(0);
            mplew.writeInt(bufflength);

            mplew.writeInt(1);
            mplew.writeInt(第二个BUFF);
            mplew.writeInt(20);
            mplew.writeInt(154709286);
            mplew.writeInt(0);
            mplew.writeInt(bufflength);
        }

        mplew.writeInt(0);
        mplew.write(1);
        mplew.writeInt(0);

        return mplew.getPacket();
    }

    public static byte[] 冲锋队长能量激发(List<Pair<MapleBuffStat, Integer>> statups) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        PacketHelper.writeBuffMask(mplew, statups);
        mplew.writeZeroBytes(5);
        mplew.writeLong(10000L);
        mplew.writeInt(849665);
        mplew.writeLong(0L);
        mplew.write(9);
        mplew.writeInt(0);
        //System.out.println("冲锋队长能量激发");
        return mplew.getPacket();
    }

    public static byte[] give新式骑宠(int 骑宠外形, int buffid, int bufflength, List<Pair<MapleBuffStat, Integer>> statups) {
       if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
       
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        PacketHelper.writeBuffMask(mplew, statups);
        for (Pair stat : statups) {
            mplew.writeInt(((Integer) stat.getRight()).intValue());
            mplew.writeInt(buffid);
            mplew.writeInt(bufflength);
        }
        mplew.writeZeroBytes(9);
        mplew.writeInt(骑宠外形);
        mplew.writeInt(buffid);
        mplew.writeInt(0);
        mplew.writeZeroBytes(5);
        mplew.write(1);
        mplew.write(27);
        mplew.writeInt(0);
        //System.out.println("give新式骑宠");
        return mplew.getPacket();
    }

    public static boolean 特殊部分BUFF多字节01(int buffid) {
        boolean mm = false;
        switch (buffid) {
            case 1211014:
            case 2221054:
            case 11101022:
            case 11111022:
            case 32111012:
            case 32120015:
            case 100001263:
            case 100001264:
                mm = true;
        }

        return mm;
    }

    public static boolean 特殊部分BUFF字节03(int buffid) {
        boolean mm = false;
        switch (buffid) {
            case 1001003:
                mm = true;
        }

        return mm;
    }

    public static boolean 特殊部分BUFF字节04(int buffid) {
        boolean mm = false;
        switch (buffid) {
            case 1321015:
                mm = true;
        }

        return mm;
    }

    public static boolean 特殊部分BUFF字节05(int buffid) {
        boolean mm = false;
        switch (buffid) {
            case 11001021:
            case 11101023:
            case 11121006:
                mm = true;
        }

        return mm;
    }

    public static int 特殊部分BUFF_Long后Int发送值(int buffid) {
        int mm = 0;
        switch (buffid) {
            case 2101001:
            case 2221054:
            case 13111023:
            case 32121056:
            case 65001002:
            case 100001263:
            case 100001264:
                mm = 0;
        }

        return mm;
    }

    public static boolean 职业200级超级技能(int buffid) {
        boolean mm = false;
        switch (buffid) {
            case 1121053:
            case 1121054:
            case 1221053:
            case 1321053:
            case 2121053:
            case 2221053:
            case 2321053:
            case 3121053:
            case 3221053:
            case 4121053:
            case 4221053:
            case 4341053:
            case 5121053:
            case 5221053:
            case 5321053:
            case 5721053:
            case 11121053:
            case 13121053:
            case 15121053:
            case 21121053:
            case 22171053:
            case 27121053:
            case 31121053:
            case 31221053:
            case 33121053:
            case 35121053:
                mm = true;
        }

        return mm;
    }

    public static boolean 特殊部分BUFF(int buffid) {
        boolean mm = false;
        switch (buffid) {
            case 1001003:
            case 1101006:
            case 1221015:
            case 1321015:
            case 2221054:
            case 2321005:
            case 2321054:
            case 4121014:
            case 4121054:
            case 4201009:
            case 4221013:
            case 15101008:
            case 5121009:
            case 5211009:
            case 5221054:
            case 5701006:
            case 5721054:
            case 11001021:
            case 11101022:
            case 11101023:
            case 11111022:
            case 11111024:
            case 11121006:
            case 11121011:
            case 11121054:
            case 13001022:
            case 13101024:
            case 13111023:
            case 13120008:
            case 13121004:
            case 15121005:
            case 23111004:
            case 23121053:
            case 23121054:
            case 24111003:
            case 24111005:
            case 27001004:
            case 27111005:
            case 31011001:
            case 31121005:
            case 31201003:
            case 31211004:
            case 31221004:
            case 31221054:
            case 32121056:
            case 33121013:
            case 35111016:
            case 35121054:
            case 36001002:
            case 36101003:
            case 36121003:
            case 50001214:
            case 51101004:
            case 51111003:
            case 60011219:
            case 61101004:
            case 61111004:
            case 61121054:
            case 65001002:
            case 65111003:
            case 80001140:
            case 100001263:
            case 100001264:
                mm = true;
        }

        return mm;
    }
//buff发包位置
    public static byte[] giveBuff(MapleCharacter chr, int buffid, int bufflength, List<Pair<MapleBuffStat, Integer>> statups, MapleStatEffect effect, int 拥有的天使的祝福类型) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        boolean is机甲 = (buffid == 35001002) || (buffid == 35120000);
        boolean is特殊部分 = 特殊部分BUFF(buffid);
        int 特殊技能 = 特殊技能(buffid);
        int 超越等级 = 20;
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (ServerProperties.IsLvkejian()) {
            String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 giveBuff --8   \r\n").toString();
            SendTo = new StringBuilder().append(SendTo).append("buffid = ").append(buffid).append("      bufflength = ").append(bufflength).append("      effect = ").append(effect.toString()).append("    statups = ").append(statups.toArray()).toString();

            FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
        }
        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

        PacketHelper.writeBuffMask(mplew, statups);

        boolean stacked = false;
        boolean 加载天使祝福戒指效果2 = true;
        boolean 加载天使祝福戒指效果 = true;
        int 执行次数 = 0;
        for (Pair stat : statups) {
            if (((MapleBuffStat) stat.getLeft()).canStack()) {
                if (!stacked) {
                    mplew.writeInt(0);
                    if ((GameConstants.魂骑士动作技能(buffid)) || (特殊部分BUFF字节05(buffid))) {
                        mplew.write(5);
                    } else if (特殊部分BUFF字节04(buffid)) {
                        mplew.write(4);
                    } else if (特殊部分BUFF字节03(buffid)) {
                        mplew.write(3);
                    } else {
                        mplew.write(0);
                    }
                    if (特殊部分BUFF多字节01(buffid)) {
                        mplew.write(1);
                    } else if (buffid == 2321005) {
                        mplew.writeInt(10);
                    }
                    mplew.writeInt(0);
                    stacked = true;
                }
                if ((buffid == 2321054) || (buffid == 1321015)) {
                    mplew.writeInt(0);
                }
                if ((stat.getLeft() == MapleBuffStat.机械师骑兽技能) && (is机甲)) {
                    mplew.writeInt(1932016);
                    mplew.writeInt(buffid);
                    mplew.writeZeroBytes(5);
                } else if ((stat.getLeft() == MapleBuffStat.机械师骑兽技能) && (buffid == 33001001)) {
                    mplew.writeInt(((Integer) stat.getRight()).intValue());
                    mplew.writeInt(buffid);
                    mplew.write(1);
                    mplew.writeInt(1);
                    //System.out.println("1");
                } else if ((stat.getLeft() == MapleBuffStat.奇袭者极速领域) && (buffid == 5121009)) {
                    mplew.writeInt(((Integer) stat.getRight()).intValue());
                    mplew.writeInt(buffid);
                    mplew.write(1);
                    mplew.writeInt(1);
                    mplew.write(1);
                    mplew.writeInt(1);
                    mplew.writeShort(300);
                    //System.out.println("2");
                } else if ((stat.getLeft() == MapleBuffStat.奇袭者极速领域) && (buffid == 15121005)) {
                    mplew.writeInt(((Integer) stat.getRight()).intValue());
                    mplew.writeInt(buffid);
                    mplew.writeLong(0L);
                    mplew.writeShort(0);
                    mplew.writeShort(200);
                    //System.out.println("3");
                } else if ((stat.getLeft() == MapleBuffStat.ANGEL_ATK) && (buffid == 13120008)) {
                    mplew.writeInt(0);
                    mplew.writeInt(2);
                    mplew.writeInt(13101024);
                    mplew.writeInt(20);
                    mplew.writeInt(608065813);
                    mplew.writeInt(21164);
                    mplew.writeInt(bufflength);
                    mplew.writeInt(buffid);
                    mplew.writeLong(((Integer) stat.getRight()).longValue());
                    mplew.writeInt(特殊部分BUFF_Long后Int发送值(buffid));
                    //System.out.println("4");
                } else {
                    if (((stat.getLeft() != MapleBuffStat.ANGEL_ATK) && (stat.getLeft() != MapleBuffStat.狂龙战士的威严_6)) || (((拥有的天使的祝福类型 != 0) && (加载天使祝福戒指效果2) && (buffid != 23111004)) || ((buffid == 13111023) && (stat.getLeft() == MapleBuffStat.ANGEL_ATK)))) {
                        加载天使祝福戒指效果2 = false;
                        mplew.writeInt(1);
                        //System.out.println("5");
                    } else if (((stat.getLeft() == MapleBuffStat.ANGEL_ATK) || (stat.getLeft() == MapleBuffStat.狂龙战士的威严_6)) && (拥有的天使的祝福类型 != 0) && (加载天使祝福戒指效果2)) {
                        mplew.writeInt(2);
                        加载天使祝福戒指效果 = false;
                        mplew.writeInt(拥有的天使的祝福类型);

                        mplew.writeLong(拥有的天使的祝福类型 == -2022747 ? 10 : 拥有的天使的祝福类型 == -2022746 ? 5 : 12);
                        mplew.writeInt(96132);
                        mplew.writeInt(600000);
                        //System.out.println("6");
                    } else if (((buffid == 31211004) || (buffid == 31011001)) && (chr.getBuffedValue(MapleBuffStat.百分比MaxHp) != null)) {
                        mplew.writeInt(2);
                        //System.out.println("7");
                    } else {
                        mplew.writeInt(1);
                        //System.out.println("8");
                    }
                    mplew.writeInt(buffid);
                    mplew.writeInt(((Integer) stat.getRight()).intValue());
                   if(buffid == 24111003){
                   mplew.writeInt(-2147285879);
                   } else if(buffid == 27111005){
                   mplew.writeInt(814474049);
                   }else{
                    mplew.writeInt(0);
                   }
                    mplew.writeInt(特殊部分BUFF_Long后Int发送值(buffid));
                    //System.out.println("9");
                }

            } else {
                if ((buffid == 30010230) && (执行次数 == 0)) {
                    超越等级 = chr.get超越();
                    //System.out.println("10");
                }

                if ((is机甲) || (buffid == 4111002) || (buffid == 65121004) || (buffid == 4211008) || (buffid == 4331002) || (buffid == 23101003) || (buffid == 3120006) || (buffid == 3220005) || (buffid == 65101002) || (buffid == 15121004) || (buffid == 31121054) || (buffid == 36111006) || (buffid == 31121054) || (buffid == 3101009)) {
                    mplew.writeInt(((Integer) stat.getRight()).intValue());
                } else if (buffid == 30010230) {
                    mplew.writeShort(超越等级);
                } else {
                    mplew.writeShort(((Integer) stat.getRight()).intValue());
                    //System.out.println("11");
                }
                if (buffid == 36121003) {
                    mplew.write(1);
                }
                mplew.writeInt(buffid);
                //System.out.println("12");
            }

            if ((执行次数 >= 5) && (is机甲)) {
                mplew.writeInt(0);
            } else {
                mplew.writeInt(bufflength);
                //System.out.println("13");
            }
            执行次数++;

            if (((stat.getLeft() == MapleBuffStat.ANGEL_ATK) || (stat.getLeft() == MapleBuffStat.狂龙战士的威严_6)) && (拥有的天使的祝福类型 != 0) && (!加载天使祝福戒指效果2) && (加载天使祝福戒指效果) && (buffid != 23111004)) {
                加载天使祝福戒指效果 = false;
                mplew.writeInt(拥有的天使的祝福类型);

                mplew.writeLong(拥有的天使的祝福类型 == -2022747 ? 10 : 拥有的天使的祝福类型 == -2022746 ? 5 : 12);
                mplew.writeInt(96132);
                mplew.writeInt(600000);
                //System.out.println("14");
            } else if ((执行次数 == 2) && (buffid == 13111023)) {
                mplew.writeInt(1);
                mplew.writeInt(buffid);
                mplew.writeInt(1500);
                mplew.writeInt(607958461);
                mplew.writeInt(0);
                mplew.writeInt(bufflength);
                //System.out.println("15");
            }
        }

        if (ServerProperties.IsLvkejian()) {
            String mms = new StringBuilder().append("技能ID: ").append(buffid).append(" 持续时间: ").append(bufflength).append(" 转换: ").append(bufflength / 1000).append("秒 --- 2  ").append(chr.getBuffedValue(MapleBuffStat.百分比MaxHp) != null ? "百分比MaxHp" : "").append(chr.getBuffedValue(MapleBuffStat.恶魔复仇者恶魔恢复) != null ? "  恶魔复仇者恶魔恢复" : "").toString();
            if (ServerProperties.ShowPacket()) {
                log.info(mms);
            }
            FileoutputUtil.packetLog("log\\辅助技能数据.log", mms);
        }

        if (((buffid == 31211004) || (buffid == 31011001)) && ((chr.getBuffedValue(MapleBuffStat.百分比MaxHp) != null) || (chr.getBuffedValue(MapleBuffStat.恶魔复仇者恶魔恢复) != null))) {
            if (ServerProperties.ShowPacket()) {
                log.info("加载 叠加部分BUFF ");
            }
            giveBuff叠加部分(mplew, buffid, bufflength);
            //System.out.println("16");
        }

        if (is特殊部分) {
            int d = giveBuffd(buffid);
            mplew.writeShort(d > 0 ? d : 0);
            mplew.writeShort(0);
            //System.out.println("17");
            if (特殊技能 == 7) {
                mplew.write(1);
                mplew.writeInt(0);
                //System.out.println("18");
            } else if (特殊技能 == 18) {
                mplew.write(0);
                mplew.writeInt(0);
                //System.out.println("19");
            } else if (特殊技能 == 23) {
                mplew.write(0);
                mplew.write(34);
                mplew.writeInt(0);
                //System.out.println("20");
            }
        } else {
            if (职业200级超级技能(buffid)) {
                mplew.writeInt(1000);
            } else {
                mplew.writeInt(0);
                //System.out.println("21");
            }

            if ((effect != null) && (effect.is祝福护甲())) {
                mplew.writeInt(effect.getEnhancedWatk());
            } else if ((effect != null) && (effect.getCharColor() > 0)) {
                mplew.writeInt(effect.getCharColor());
            } else if ((effect != null) && (effect.isInflation())&&(buffid!= -2003576)) {
                mplew.writeInt(effect.getInflation());
                //System.out.println("22");
            }

            if ((buffid == 11001022) || (buffid == 11101024) || (buffid == 31121054) || (buffid == 21101005) || (buffid == 21121000) || (buffid == 1301006)) {
                mplew.write(5);
                //System.out.println("23");
            } else if ((buffid == -2022125) || (buffid == 21121054) || (buffid == 21000000) || (buffid == 21101003) || (buffid == 21001003) || (buffid == 21111012) || (buffid == 21111001) || (buffid == 20001005) || (buffid == 31121007) || (buffid == 31101003) || (buffid == 31111004) || (buffid == 1301007)) {
                mplew.write(4);
            } else if (buffid == 1101013) {
                mplew.write(3);
            } else if ((buffid == 1211010) || (buffid == 1211011)) {
                mplew.write(18);
            } else if ((buffid == 1321007) || (buffid == 1301013)) {
                mplew.write(6);
                mplew.writeInt(buffid);
                mplew.writeInt(0);
                //System.out.println("24");
            } else if (buffid == 1311015) {
                mplew.write(4);
                mplew.writeInt(113);
            } else if (buffid == 35001002) {
                mplew.writeInt(0);
                mplew.write(1);
                mplew.write(4);
            } else if (特殊技能 == 11) {
                mplew.writeZeroBytes(5);
                //System.out.println("25");
            } else if ((buffid == 31121054) || (buffid == 21111001) || (buffid == 27111004) || (buffid == 2211012) || (buffid == 2111011)) {
                mplew.writeShort(0);
            } else if (is机甲) {
                mplew.write(1);
                mplew.write(4);
            } else if (buffid == 33001001) {
                mplew.write(1);
                mplew.write(6);
            } else if (buffid == 33111007) {
                mplew.write(1);
                mplew.write(4);
            } else if (buffid == 33111009) {
                mplew.write(0);
                mplew.write(88);
                mplew.write(5);
            } else if (buffid == 1221054) {
                mplew.write(6);
            } else {
                mplew.write(0);
            }
            
            if (buffid == 20031210) {
                mplew.writeInt(20);
            } else if (buffid == 3211012) {
                mplew.writeInt(50);
            } else if (buffid == 3111011) {
                mplew.writeInt(40);
            } else if (buffid == 3101009) {
                mplew.writeInt(1);
            }//else if (buffid == 4341002) {
               // mplew.write(1);//119终极斩+
        //    }

            if ((多4个字节00(buffid)) || (特殊技能 == 1) || (特殊技能 == 5) || (特殊技能 == 6) || (特殊技能 == 9) || (特殊技能 == 10) || (特殊技能 == 11)) {
                mplew.writeInt(0);
                //System.out.println("27");
            }

            int a = giveBuffa(buffid);
            if (a > 0) {
                mplew.write(a);
                //System.out.println("28");
            }

            int b = giveBuffb(buffid);
            if (b > 0) {
                mplew.writeShort(b);
                //System.out.println("29");
                if ((buffid == 22181004) || (buffid == 22181000) || (buffid == 21000000) || (buffid == 21111001)) {
                    mplew.writeInt(0);
                } else if ((buffid == 2121054) || (buffid == 61121009)) {
                    mplew.writeZeroBytes(3);
                }

            }

            int c = giveBuffc(buffid);
            if ((特殊技能 < 0) && (!is机甲) && ((c <= 0) || ((effect != null) && (!effect.is影分身()))) && (buffid != 61101004)) {
                mplew.write(0);
                mplew.writeInt(0);
                mplew.writeInt(0);
                mplew.write(3);
                mplew.writeInt(0);
                //System.out.println("30");
            } else if (特殊技能 == 0) {
                mplew.writeInt(0);
                //System.out.println("31");
            } else if (特殊技能 == 1) {
                mplew.writeInt(0);
                mplew.write(1);
                mplew.write(4);
                mplew.writeInt(0);
                //System.out.println("32");
            } else if (特殊技能 == 2) {
                mplew.writeLong(0L);
                mplew.writeInt(1000);
                mplew.write(1);
                mplew.writeInt(0);
                //System.out.println("33");
            } else if (特殊技能 == 3) {
                mplew.writeLong(0L);
                mplew.writeInt(0);//115+
                mplew.write(0);
                mplew.write(20);
                mplew.writeInt(0);
                //System.out.println("34");
            } else if (特殊技能 == 4) {
                mplew.write(10);
                mplew.writeInt(0);
                mplew.writeInt(600);
                mplew.write(1);
                mplew.writeInt(0);
                //System.out.println("35");
            } else if (特殊技能 == 5) {
                mplew.writeShort(0);
                mplew.write(1);
                mplew.writeInt(0);
                //System.out.println("36");
            } else if (特殊技能 == 6) {
                mplew.writeInt(0);
                mplew.write(1);//魔法盾无效果修改
                mplew.writeInt(0);
                //System.out.println("37");
            } else if (特殊技能 == 8) {
                mplew.writeLong(0L);
                mplew.writeInt(1000);
                mplew.write(1);
                mplew.writeInt(0);
                //System.out.println("38");
            } else if (特殊技能 == 9) {
                mplew.writeLong(0L);
                //System.out.println("39");
            } else if (特殊技能 == 10) {
                mplew.writeInt(1000);
                mplew.write(1);
                mplew.writeInt(0);
                //System.out.println("40");
            } else if (特殊技能 == 11) {
                mplew.writeInt(600);
                mplew.write(0);
                mplew.writeInt(0);
                //System.out.println("41");
            } else if (特殊技能 == 12) {
                mplew.writeLong(0L);
                mplew.write(1);
                mplew.write(27);
                mplew.writeInt(0);
                //System.out.println("42");
            } else if (特殊技能 == 13) {
                mplew.writeInt(0);
                mplew.write(0);
                mplew.write(4);
                mplew.writeInt(0);
                //System.out.println("43");
            } else if (特殊技能 == 14) {
                mplew.writeLong(0L);
                mplew.write(0);
                mplew.write(67);
                mplew.writeInt(0);
                //System.out.println("44");
            } else if (特殊技能 == 15) {
                mplew.writeLong(0L);
                mplew.write(0);
                mplew.write(32);
                mplew.writeInt(0);
                //System.out.println("45");
            } else if (特殊技能 == 16) {
                mplew.writeInt(30);
                mplew.writeLong(0L);
                mplew.write(0);
                //System.out.println("46");
            } else if (特殊技能 == 17) {
                mplew.writeLong(0L);
                mplew.write(1);
                mplew.write(8);
                mplew.writeInt(0);
                //System.out.println("47");
            } else if (特殊技能 == 19) {
                mplew.writeZeroBytes(12);
                mplew.write(1);
                mplew.writeInt(0);
                //System.out.println("48");
            } else if (特殊技能 == 20) {
                mplew.writeInt(0);
                mplew.writeInt(1000);
                mplew.write(0);
                mplew.write(25);
                mplew.writeInt(0);
                //System.out.println("49");
            } else if (特殊技能 == 21) {
                mplew.writeInt(0);
                mplew.writeInt(1000);
                mplew.write(0);
                mplew.writeInt(0);
                //System.out.println("50");
            } else if (特殊技能 == 22) {
                mplew.writeLong(0L);
                mplew.writeInt(600);
                mplew.write(0);
                mplew.writeInt(0);
                //System.out.println("51");
            }

        }
        //System.out.println("giveBuff");
        return mplew.getPacket();
    }

    public static int 特殊技能(int buffid) {
        int f = -1;
        switch (buffid) {
            case -2022748:
            case -2022747:
            case -2022746:
            case -2022125:
            case 1121053:
            case 1121054:
            case 1211014:
            case 1221053:
            case 1321053:
            case 1321054:
            case 2101001:
            case 2121053:
            case 2121054:
            case 2201001:
            case 2221053:
            case 2321053:
            case 3121053:
            case 3221053:
            case 4121053:
            case 4221053:
            case 4341053:
            case 5121053:
            case 5221053:
            case 5301003:
            case 5321053:
            case 5721053:
            case 11121053:
            case 13121053:
            case 15121054:
            case 21121053:
            case 22171053:
            case 22171054:
            case 27121053:
            case 31121053:
            case 31221053:
            case 32111012:
            case 32120015:
            case 32121053:
            case 33001001:
            case 33111007:
            case 33121053:
            case 33121054:
            case 35001002:
            case 35120000:
            case 35121053:
            case 61121009:
                f = 0;
                break;
            case 2111005:
            case -2003576:
            case 13120007:
            case 22171052:
            case 22181000:
            case 22181004:
            case 33121004:
            case 35111004:
            case 35121013:
                f = 1;
                break;
            case 36121004:
                f = 2;
                break;
            case 30021237:
                f = 3;
                break;
            case 36111003:
                f = 4;
                break;
            case 1211010:
            case 1311015:
            case 2111011:
            case 2211012:
            case 2301003:
            case 2311009:
            case 2311012:
            case 3101004:
            case 3120017:
            case 3121007:
            case 3121016:
            case 3201004:
            case 3221006:
            case 4201011:
            case 4311005:
            case 21101005:
            case 21101006:
            case 24111002:
            case 32111014:
            case 33111009:
                f = 5;
                break;
            case 1101013:
            case 1221054:
            case 1301013:
            case 2001002:
            case 2121004:
            case 2201009:
            case 2221004:
            case 2221009:
            case 2321004:
            case 3101009:
            case 3111000:
            case 3111011:
            case 3211012:
            case 4001003:
            case 4111002:
            case 4211003:
            case 4211008:
            case 4331002:
            case 5311004:
            case 5321010:
            case 5321054:
            case 11001022:
            case 12101005:
            case 13121054:
            case 15001022:
            case 15111023:
            case 15111024:
            case 20031205:
            case 20031210:
            case 21101003:
            case 21111001:
            case 21121054:
            case 22111001:
            case 22131002:
            case 23101003:
            case 23121004:
            case 27121005:
            case 31101003:
            case 31111004:
            case 32101004:
            case 32111004:
            case 32111006:
            case 32111010:
            case 33101003:
            case 35101007:
            case 36101002:
            case 36111006:
            case 51111004:
            case 60001216:
            case 60001217:
            case 61111003:
            case 65101002:
            case 65111004:
            case 65121004:
            case 100001274:
                f = 6;
                break;
            case 1001003:
            case 1221015:
            case 1321015:
            case 2321054:
            case 4121014:
            case 4121054:
            case 4201009:
            case 4221013:
            case 15101008:
            case 5211009:
            case 5221054:
            case 5701006:
            case 5721054:
            case 11001021:
            case 11101022:
            case 11101023:
            case 11111022:
            case 11111024:
            case 11121006:
            case 11121011:
            case 11121054:
            case 13001022:
            case 13101024:
            case 13111023:
            case 13120008:
            case 13121004:
            case 23111004:
            case 23121054:
            case 24111003:
            case 24111005:
            case 27001004:
            case 27111005:
            case 31011001:
            case 31121005:
            case 31201003:
            case 31211004:
            case 31221004:
            case 31221054:
            case 32121056:
            case 33121013:
            case 35111016:
            case 35121054:
            case 36001002:
            case 36101003:
            case 36121003:
            case 50001214:
            case 51111003:
            case 60011219:
            case 61101004:
            case 61111004:
            case 61121054:
            case 65001002:
            case 65111003:
            case 80001140:
                f = 7;
                break;
            case 24121004:
            case 27121006:
                f = 8;
                break;
            case 33101005:
                f = 9;
                break;
            case 2111008:
            case 2211008:
            case 4111009:
            case 5121015:
            case 5201008:
            case 5221018:
            case 23111005:
            case 24121054:
            case 27111004:
            case 31121007:
            case 31211003:
            case 32121010:
            case 51121006:
                f = 10;
                break;
            case 3121002:
            case 13121005:
                f = 11;
                break;
            case 4301003:
                f = 12;
                break;
            case -2002010:
                f = 13;
                break;
            case 32101003:
            case 32120014:
                f = 14;
                break;
            case 80001242:
                f = 15;
                break;
            case 27110007:
                f = 16;
                break;
            case 35121005:
                f = 17;
                break;
            case 1101006:
            case 2221054:
            case 2321005:
            case 5121009:
            case 15121005:
            case 23121053:
            case 51101004:
            case 100001263:
                f = 18;
                break;
            case 3221054:
                f = 19;
                break;
            case 2221000:
            case 4001005:
            case 23121005:
            case 27121009:
            case 36121008:
            case 61121014:
                f = 20;
                break;
            case 1211011:
            case 4341007:
            case 27111006:
                f = 21;
                break;
            case 3221002:
                f = 22;
                break;
            case 100001264:
                f = 23;
        }

        if (GameConstants.所有职业冒险岛勇士(buffid)) {
            f = 20;
        }
        return f;
    }

    public static void giveBuff叠加部分(MaplePacketLittleEndianWriter mplew, int buffid, int bufflength) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        switch (buffid) {
            case 31211004:
                mplew.writeInt(31011001);
                mplew.writeLong(20L);
                mplew.writeInt(6568);
                mplew.writeInt(bufflength);
                break;
            case 31011001:
                mplew.writeInt(31211004);
                mplew.writeLong(20L);
                mplew.writeInt(4137);
                mplew.writeInt(bufflength);
        }
    }

    public static boolean 多4个字节00(int buffid) {
        switch (buffid) {
            case 2121054:
            case 2211008:
            case 2211012:
            case 4001003:
            case 23111005:
            case 24121054:
            case 27111004:
            case 31211003:
            case 32111005:
            case 32121010:
            case 36101002:
            case 36111006:
            case 61121009:
                return true;
        }
        return false;
    }

    public static int giveBuffa(int buffid) {
        int a = 0;
        switch (buffid) {
            case 27121005:
                a = 1;
                break;
            case 33101005:
                a = 120;
                break;
            case 2311012:
            case 32001003:
            case 32101003:
            case 32120000:
            case 32120013:
            case 32120014:
            case 33101006:
                a = 1;
                break;
            case 22181000:
            case 22181004:
                a = 0;
                break;
            case 5301003:
                a = 9;
        }

        return a;
    }

    public static int giveBuffb(int buffid) {
        int b = 0;
        switch (buffid) {
            case 2311012:
                b = 1800;
                break;
            case 1211010:
            case 3101004:
            case 3201004:
                b = 450;
                break;
            case 3120017:
            case 3121016:
                b = 630;
                break;
            case 2301003:
                b = 720;
                break;
            case 1311015:
                b = 540;
                break;
            case 2211012:
                b = 960;
                break;
            case 21101005:
            case 33111009:
                b = 600;
                break;
            case 2121054:
                b = 990;
                break;
            case 3121007:
            case 3221006:
            case 32111014:
                b = 600;
                break;
            case 2311009:
                b = 300;
                break;
            case 1111002:
            case 3211000:
            case 4201011:
            case 21111001:
            case 22181000:
            case 22181004:
            case 33111004:
                b = 1000;
                break;
            case 21101006:
                b = 720;
                break;
            case 2111011:
            case 4311005:
            case 24111002:
            case 61121009:
                b = 1000;
        }

        return b;
    }

    public static int giveBuffc(int buffid) {
        int c = 0;
        switch (buffid) {
            case 8000:
            case 4001003:
            case 5801007:
            case 5811005:
            case 5821003:
            case 10008000:
            case 13111005:
            case 14001003:
            case 14001007:
            case 20008000:
            case 20018000:
            case 20028000:
            case 30008000:
            case 30018000:
            case 33111007:
            case 35121010:
                c = 6;
                break;
            case 31121004:
            case 32121007:
                c = 7;
                break;
            case 1002:
            case 10001002:
            case 20001002:
            case 20011002:
            case 32121003:
                c = 8;
                break;
            case 32101003:
                c = 9;
                break;
            case 20021001:
            case 30001001:
            case 30011001:
                c = 10;
                break;
            case 1026:
            case 10001026:
            case 20001026:
            case 20011026:
            case 20021026:
            case 30001026:
            case 30011026:
                c = 17;
        }

        return c;
    }

    public static int giveBuffd(int buffid) {
        int d = 0;
        switch (buffid) {
            case 4121014:
            case 4201009:
            case 5701006:
            case 23111004:
            case 24111003:
            case 24111005:
            case 31211004:
            case 36101003:
            case 36121003:
            case 50001214:
            case 60011219:
            case 61121054:
            case 80001140:
                return 1000;
            case 4221013:
            case 5121009:
            case 15121005:
                return 600;
            case 1321015:
                return 1200;
            case 1221015:
                return 1560;
            case 1101006:
                return 480;
        }
        return d;
    }

    public static byte[] giveDebuff(MapleDisease statups, int x, int skillid, int level, int duration) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (ServerProperties.IsLvkejian()) {
            String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 giveDebuff-- 10   \r\n").toString();
            SendTo = new StringBuilder().append(SendTo).append("skillid = ").append(skillid).append("      level = ").append(level).append("    x =").append(x).append("      duration = ").append(duration).append("       statups = ").append(statups.toString()).toString();

            FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
        }
        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());


        PacketHelper.writeSingleMask(mplew, statups);

        mplew.writeShort(x);
        mplew.writeShort(skillid);
        mplew.writeShort(level);
        mplew.writeInt(duration);
        mplew.writeShort(0);
        mplew.writeShort(0);
        mplew.writeShort(1);
        mplew.write(1);
        //System.out.println("giveDebuff");
        return mplew.getPacket();
    }

    public static byte[] giveForeignDebuff(int cid, MapleDisease statups, int skillid, int level, int x) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_FOREIGN_BUFF.getValue());
        mplew.writeInt(cid);

        PacketHelper.writeSingleMask(mplew, statups);
        if (skillid == 125) {
            mplew.writeShort(0);
            mplew.write(0);
        }
        mplew.writeShort(x);
        mplew.writeShort(skillid);
        mplew.writeShort(level);
        mplew.writeShort(0);
        mplew.writeShort(0);
        mplew.write(1);
        mplew.write(1);
        return mplew.getPacket();
    }

    public static byte[] cancelForeignDebuff(int cid, MapleDisease mask) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CANCEL_FOREIGN_BUFF.getValue());
        mplew.writeInt(cid);

        PacketHelper.writeSingleMask(mplew, mask);
        mplew.write(3);
        mplew.write(1);
        return mplew.getPacket();
    }

    public static byte[] showMonsterRiding(int cid, List<Pair<MapleBuffStat, Integer>> statups, int itemId, int skillId) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_FOREIGN_BUFF.getValue());
        mplew.writeInt(cid);

        PacketHelper.writeBuffMask(mplew, statups);

        mplew.writeShort(0);
        mplew.write(7);
        mplew.writeLong(0L);
        mplew.writeLong(0L);
        mplew.writeInt(0);
        mplew.writeInt(itemId);
        mplew.writeInt(skillId);
        mplew.write(1);
        mplew.writeInt(1);
        mplew.writeShort(0);

        return mplew.getPacket();
    }

    public static byte[] 斗气集中反馈(int cid, List<Pair<MapleBuffStat, Integer>> statups, int 斗气数量) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_FOREIGN_BUFF.getValue());
        mplew.writeInt(cid);

        PacketHelper.writeBuffMask(mplew, statups);

        mplew.writeShort(斗气数量);
        mplew.write(0);
        mplew.writeInt(2);
        mplew.writeZeroBytes(19);

        return mplew.getPacket();
    }

    public static byte[] giveForeignBuff(int cid, List<Pair<MapleBuffStat, Integer>> statups, MapleStatEffect effect) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_FOREIGN_BUFF.getValue());
        mplew.writeInt(cid);

        PacketHelper.writeBuffMask(mplew, statups);

        short 特殊类型 = 0;
        for (Pair statup : statups) {
            if ((statup.getLeft() == MapleBuffStat.狂龙战士的威严_6) || (statup.getLeft() == MapleBuffStat.影分身) || (statup.getLeft() == MapleBuffStat.金属机甲) || (statup.getLeft() == MapleBuffStat.黑暗灵气) || (statup.getLeft() == MapleBuffStat.黄色灵气) || (statup.getLeft() == MapleBuffStat.蓝色灵气) || (statup.getLeft() == MapleBuffStat.GIANT_POTION) || (statup.getLeft() == MapleBuffStat.精神连接) || (statup.getLeft() == MapleBuffStat.PYRAMID_PQ) || (statup.getLeft() == MapleBuffStat.属性攻击) || (statup.getLeft() == MapleBuffStat.精神注入) || (statup.getLeft() == MapleBuffStat.变身术)) {
                mplew.writeShort(((Integer) statup.getRight()).shortValue());
                mplew.writeInt(effect.isSkill() ? effect.getSourceId() : -effect.getSourceId());
                mplew.writeInt(0);
            } else if (statup.getLeft() == MapleBuffStat.FAMILIAR_SHADOW) {
                mplew.writeInt(((Integer) statup.getRight()).intValue());
                mplew.writeInt(effect.getCharColor());
            } else {
                mplew.writeShort(((Integer) statup.getRight()).shortValue());
            }

            if (statup.getLeft() == MapleBuffStat.狂龙战士的威严_6) {
                特殊类型 = 1;
            } else if (statup.getLeft() == MapleBuffStat.无形箭弩) {
                特殊类型 = 2;
            } else if (statup.getLeft() == MapleBuffStat.斗气集中) {
                mplew.write(0);
                mplew.write(2);
                mplew.write(0);
            }

        }

        mplew.writeLong(0L);
        mplew.writeLong(0L);

        mplew.writeShort(0);
        mplew.write(0);

        if (特殊类型 == 0) {
            mplew.writeShort(0);
        } else if (特殊类型 == 1) {
            mplew.writeShort(1000);
        } else if (特殊类型 == 2) {
            mplew.writeShort(0);
            mplew.writeShort(450);
        }
        mplew.writeInt(0);
        mplew.write(1);

        return mplew.getPacket();
    }

    public static byte[] cancelForeignBuff(int cid, List<MapleBuffStat> statups) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CANCEL_FOREIGN_BUFF.getValue());
        mplew.writeInt(cid);
        PacketHelper.writeMask(mplew, statups);
        mplew.write(3);
        mplew.write(1);

        return mplew.getPacket();
    }

    public static byte[] cancelBuff(List<MapleBuffStat> statups) {
                if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CANCEL_BUFF.getValue());
        //mplew.write(0);//117瞎改

        PacketHelper.writeMask(mplew, statups);
        for (MapleBuffStat z : statups) {
            if (z.canStack()) {
                mplew.writeInt(0);
            }

        }
               mplew.write(3);
        return mplew.getPacket();
    }

    public static byte[] cancelHoming() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CANCEL_BUFF.getValue());

        PacketHelper.writeSingleMask(mplew, MapleBuffStat.导航辅助);

        return mplew.getPacket();
    }

    public static byte[] 取消特殊技能(int buffid, int 魂骑士前置技能, List<MapleBuffStat> statups, int 特殊值, boolean 机甲) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CANCEL_BUFF.getValue());

        PacketHelper.writeMask(mplew, statups);
        for (MapleBuffStat z : statups) {
            if ((z.canStack()) && (!机甲)) {
                mplew.writeInt(0);
            }
        }
        if (机甲) {
            mplew.writeInt(0);
            mplew.write(特殊值);
            mplew.write(1);
        } else if (特殊值 >= 0) {
            mplew.write(特殊值);
        }
        if (GameConstants.新式骑宠(buffid)) {
            mplew.write(1);
        } else if (((buffid == 11121005) && (魂骑士前置技能 == 11101022)) || (buffid == 13120008)) {
            mplew.writeInt(0);
        }

        return mplew.getPacket();
    }

    public static byte[] cancelCH() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CANCEL_BUFF.getValue());

        PacketHelper.writeSingleMask(mplew, MapleBuffStat.催化);
        mplew.writeInt(0);
        return mplew.getPacket();
    }

    

    public static byte[] 取消风灵信天翁() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CANCEL_BUFF.getValue());

        PacketHelper.writeSingleMask(mplew, MapleBuffStat.风灵信天翁_2);
        mplew.writeZeroBytes(28);

        return mplew.getPacket();
    }

    public static byte[] 取消狂龙终极变形(List<MapleBuffStat> statups) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CANCEL_BUFF.getValue());

        PacketHelper.writeMask(mplew, statups);
        mplew.writeLong(0L);
        mplew.write(7);

        return mplew.getPacket();
    }

    public static byte[] cancelDebuff(MapleDisease mask) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CANCEL_BUFF.getValue());

        PacketHelper.writeSingleMask(mplew, mask);
        mplew.write(3);
        mplew.write(0);
        mplew.write(1);

        if (ServerProperties.IsLvkejian()) {
            String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append(" 通过 cancelBuff --- 4").toString();
            FileoutputUtil.packetLog("log\\BUFF技能检测.log", SendTo);
        }

        return mplew.getPacket();
    }

    public static byte[] updateMount(MapleCharacter chr, boolean levelup) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.UPDATE_MOUNT.getValue());
        mplew.writeInt(chr.getId());
        mplew.writeInt(chr.getMount().getLevel());
        mplew.writeInt(chr.getMount().getExp());
        mplew.writeInt(chr.getMount().getFatigue());
        mplew.write(levelup ? 1 : 0);

        return mplew.getPacket();
    }

    public static byte[] mountInfo(MapleCharacter chr) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.UPDATE_MOUNT.getValue());
        mplew.writeInt(chr.getId());
        mplew.write(1);
        mplew.writeInt(chr.getMount().getLevel());
        mplew.writeInt(chr.getMount().getExp());
        mplew.writeInt(chr.getMount().getFatigue());

        return mplew.getPacket();
    }

/*    public static byte[] getTradeInvite(MapleCharacter c, boolean 现金交易, boolean 石头剪刀布) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
        mplew.write(21);
        mplew.write(石头剪刀布 ? 3 : 现金交易 ? 7 : 4);
        mplew.writeMapleAsciiString(c.getName());
        mplew.writeInt(0);
        //System.out.println("getTradeInvite");
        return mplew.getPacket();
    }*/
    
    
            public static byte[] getTradeInvite(MapleCharacter c) {
            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

            mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
            mplew.write(PlayerInteractionHandler.Interaction.交易邀请.action);
            mplew.write(4);//was 3
            mplew.writeMapleAsciiString(c.getName());
//            mplew.writeInt(c.getLevel());
            mplew.writeInt(c.getJob());
            return mplew.getPacket();
        }

    public static byte[] getTradeMesoSet(byte number, long meso) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
        mplew.write(4);
        mplew.write(number);
        mplew.writeLong(meso);
        //System.out.println("getTradeMesoSet");   
        return mplew.getPacket();
    }

    public static byte[] getTradeItemAdd(byte number, Item item) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
        mplew.write(0);
        mplew.write(number);
        PacketHelper.addItemInfo(mplew, item, false, false, true);
        //System.out.println("getTradeItemAdd");
        return mplew.getPacket();
    }

    /**
     *交易
     * @param c
     * @param trade
     * @param number
     * @param 现金交易
     * @param 石头剪刀布
     * @return
     */
    public static byte[] getTradeStart(MapleClient c, MapleTrade trade, byte number, boolean 现金交易, boolean 石头剪刀布) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
        mplew.write(20);
        mplew.write(石头剪刀布 ? 3 : 现金交易 ? 7 : 4);
        mplew.write(2);
        mplew.write(number);
        if (number == 1) {
            mplew.write(0);
            PacketHelper.addCharLook(mplew, trade.getPartner().getChr(), false, false, false);
            mplew.writeMapleAsciiString(trade.getPartner().getChr().getName());
            mplew.writeShort(trade.getPartner().getChr().getJob());
        }

        mplew.write(number);
        PacketHelper.addCharLook(mplew, c.getPlayer(), false, false, false);
        mplew.writeMapleAsciiString(c.getPlayer().getName());
        mplew.writeShort(c.getPlayer().getJob());
        mplew.write(255);
        //System.out.println("getTradeStart");     
        return mplew.getPacket();
    }

    public static byte[] 现金交易发送的信息(int 操作类型) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
        mplew.write(30);
        mplew.write(操作类型);
        mplew.write(7);
        mplew.write(1);
        if (操作类型 == 19) {
            mplew.writeZeroBytes(5);
        } else if (操作类型 == 16) {
            mplew.writeInt(0);
        }
        //System.out.println("现金交易发送的信息");
        return mplew.getPacket();
    }

    public static byte[] getTradeConfirmation() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
        mplew.write(8);
        //System.out.println("getTradeConfirmation");
        return mplew.getPacket();
    }

    public static byte[] TradeMessage(byte UserSlot, byte message) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
        mplew.write(28);
        mplew.write(UserSlot);
        mplew.write(message);
        //System.out.println("TradeMessage");
        return mplew.getPacket();
    }

    public static byte[] 开始石头剪刀布() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
        mplew.write(97);
        //System.out.println("开始石头剪刀布");
        return mplew.getPacket();
    }

    public static byte[] 石头剪刀布结果(byte 玩家数值代号, byte 结果) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
        mplew.write(144);
        mplew.write(玩家数值代号);
        mplew.write(结果);
        //System.out.println("石头剪刀布结果");
        return mplew.getPacket();
    }

    public static byte[] getTradeCancel(byte UserSlot, int unsuccessful, boolean 退出石头剪刀布) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
        mplew.write(28);
        mplew.write(UserSlot);
        mplew.write(退出石头剪刀布 ? 3 : 9);
        //System.out.println("getTradeCancel");
        return mplew.getPacket();
    }

    public static byte[] 石头剪刀布状态(byte 数值代号, byte 石头剪刀布类型) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHITOU_JIANDAO_BU.getValue());
        mplew.write(28);
        mplew.write(HexTool.getByteArrayFromHexString("BF 69 96 00"));
        mplew.write(石头剪刀布类型);
        mplew.write(HexTool.getByteArrayFromHexString("95 FC 04 00"));
        mplew.writeShort(0);
        mplew.write(HexTool.getByteArrayFromHexString("DD AB"));
        mplew.write(2);
        mplew.write(2);
        mplew.write(数值代号);

        return mplew.getPacket();
    }

    public static byte[] getNPCTalk0(int npc, byte msgType, String talk, String endBytes, byte type) {
        return getNPCTalk0(npc, msgType, talk, endBytes, type, npc);
    }

    public static byte[] getNPCTalk0(int npc, byte msgType, String talk, String endBytes, byte type, int diffNPC) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.NPC_TALK.getValue());
        mplew.write(4);
        mplew.writeInt(npc);

        mplew.write(0);

        mplew.write(msgType);
        mplew.write(type);
        mplew.write(0);
        if ((type & 0x4) != 0) {
            mplew.writeInt(diffNPC);
        }
        mplew.writeMapleAsciiString(talk);
        mplew.write(HexTool.getByteArrayFromHexString(endBytes));

        return mplew.getPacket();
    }

    /**
     * 这里是次元之境和冒险岛运营员还有时间门
     * @param npcid
     * @param sel
     * @return
     */
    public static byte[] getMapSelection0(int npcid, String sel) {
        if (ServerProperties.ShowPacket()) {
            log.info("调用: " + new java.lang.Throwable().getStackTrace()[0]);
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.NPC_TALK.getValue());
        mplew.write(4);
        mplew.writeInt(npcid);
        mplew.write(0);
        
        //mplew.writeShort((short) msgType);
        mplew.writeShort(17);//117=16
        
        mplew.writeInt(npcid == 2083006 ? 1 : npcid == 9010000 ? 3 : npcid == 3000012 ? 5 : 0);
        mplew.writeInt(npcid == 9010022 ? 809 : 0);
        mplew.writeMapleAsciiString(sel);

        return mplew.getPacket();
    }

    public static byte[] getNPCTalkStyle0(int npc, String talk, int[] styles, int card, boolean android) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("NPC调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.NPC_TALK.getValue());
        mplew.write(4);
        mplew.writeInt(npc);
        mplew.write(0);
        mplew.writeShort(android ? 10 : 9);
        if (!android) {
            mplew.writeShort(0);
        }
        mplew.writeMapleAsciiString(talk);
        mplew.write(styles.length);
        for (int i = 0; i < styles.length; i++) {
            mplew.writeInt(styles[i]);
        }
        mplew.writeInt(card);

        return mplew.getPacket();
    }

    public static byte[] get萝莉换发型选择(int npc) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.NPC_TALK.getValue());
        mplew.write(4);
        mplew.writeInt(npc);
        mplew.write(0);
        mplew.writeShort(21);

        return mplew.getPacket();
    }

    public static byte[] get恶魔转职窗口(int npc) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.NPC_TALK.getValue());
        mplew.write(3);
        mplew.writeInt(0);
        mplew.write(1);
        mplew.writeInt(npc);
        mplew.write(20);
        mplew.write(1);
        mplew.write(1);
        mplew.writeZeroBytes(9);

        return mplew.getPacket();
    }

    public static byte[] getNPCTalkNum0(int npc, String talk, int def, int min, int max) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.NPC_TALK.getValue());
        mplew.write(4);
        mplew.writeInt(npc);
        mplew.write(0);
        mplew.writeShort(4);
        mplew.write(0);
        mplew.writeMapleAsciiString(talk);
        mplew.writeInt(def);
        mplew.writeInt(min);
        mplew.writeInt(max);

        return mplew.getPacket();
    }

    public static byte[] getNPCTalkText0(int npc, String talk) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.NPC_TALK.getValue());
        mplew.write(4);
        mplew.writeInt(npc);
        mplew.write(0);
        mplew.writeShort(3);
        mplew.write(0);//119+
        mplew.writeMapleAsciiString(talk);
        mplew.writeInt(0);
        mplew.writeInt(0);//119+
        //mplew.writeShort(11);//119-

        return mplew.getPacket();
    }

    public static byte[] getAndroidTalkStyle0(int npc, String talk, int[] args, int card) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.NPC_TALK.getValue());
        mplew.write(4);
        mplew.writeInt(npc);
        mplew.write(0);
        mplew.writeShort(10);
        mplew.writeMapleAsciiString(talk);
        mplew.write(args.length);
        for (int i = 0; i < args.length; i++) {
            mplew.writeInt(args[i]);
        }
        mplew.writeInt(card);

        return mplew.getPacket();
    }

    public static byte[] showForeignEffect(int cid, int effect) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_FOREIGN_EFFECT.getValue());
        mplew.writeInt(cid);

        mplew.write(effect);

        return mplew.getPacket();
    }

    public static byte[] showBuffeffect(int cid, int skillid, int effectid, int playerLevel, int skillLevel) {
        return showBuffeffect(cid, skillid, effectid, playerLevel, skillLevel, (byte) 3);
    }

    public static byte[] showBuffeffect(int cid, int skillid, int effectid, int playerLevel, int skillLevel, byte direction) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_FOREIGN_EFFECT.getValue());
        mplew.writeInt(cid);
        //mplew.write(effectid);
        mplew.write(1);
        mplew.writeInt(skillid);
        mplew.write(playerLevel);
        mplew.write(skillLevel);
        if (direction != 3) {
            mplew.write(direction);
        }
        return mplew.getPacket();
    }

    public static byte[] showOwnBuffEffect(int skillid, int effectid, int playerLevel, int skillLevel) {
        return showOwnBuffEffect(skillid, effectid, playerLevel, skillLevel, (byte) 3);
    }

    public static byte[] showOwnBuffEffect(int skillid, int effectid, int playerLevel, int skillLevel, byte direction) {
        boolean isPicc = (skillid == 1311013);
        if (ServerProperties.ShowPacket());
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
       // mplew.write(effectid);
        mplew.write(direction);
        mplew.writeInt(skillid);
       // mplew.write(playerLevel - 1);//119改戒指效果
        mplew.write(skillLevel);
       // mplew.write(isPicc ? 1 : 0);
        if (direction != 3) {
            mplew.write(direction);
        }

        return mplew.getPacket();
    }

    public static byte[] showOwnDiceEffect(int skillid, int effectid, int effectid2, int level) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
        mplew.write(3);
        mplew.writeInt(effectid);
        mplew.writeInt(effectid2);
        mplew.writeInt(skillid);
        mplew.write(level);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] showDiceEffect(int cid, int skillid, int effectid, int effectid2, int level) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_FOREIGN_EFFECT.getValue());
        mplew.writeInt(cid);
        mplew.write(3);
        mplew.writeInt(effectid);
        mplew.writeInt(effectid2);
        mplew.writeInt(skillid);
        mplew.write(level);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] showItemLevelupEffect() {
        return showSpecialEffect(19);
    }

    public static byte[] showForeignItemLevelupEffect(int cid) {
        return showSpecialEffect(cid, 19);
    }

    public static byte[] showSpecialEffect(int effect) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
        mplew.write(effect);

        return mplew.getPacket();
    }

    public static byte[] showSpecialEffect(int cid, int effect) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_FOREIGN_EFFECT.getValue());
        mplew.writeInt(cid);
        mplew.write(effect);

        return mplew.getPacket();
    }

    public static byte[] updateSkill(int skillid, int level, int masterlevel, long expiration) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        boolean isProfession = (skillid == 92000000) || (skillid == 92010000) || (skillid == 92020000) || (skillid == 92030000) || (skillid == 92040000);
        mplew.writeShort(SendPacketOpcode.UPDATE_SKILLS.getValue());
        mplew.writeShort(isProfession ? 0 : 1);
        mplew.write(0);
        mplew.writeShort(1);
        mplew.writeInt(skillid);
        mplew.writeInt(level);
        mplew.writeInt(masterlevel);
        PacketHelper.addExpirationTime(mplew, expiration);
        mplew.write(isProfession ? 4 : 3);

        return mplew.getPacket();
    }

    public static byte[] updateQuestMobKills(MapleQuestStatus status) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(1);
        mplew.writeShort(status.getQuest().getId());
        mplew.write(1);

        StringBuilder sb = new StringBuilder();
        for (Iterator i$ = status.getMobKills().values().iterator(); i$.hasNext();) {
            int kills = ((Integer) i$.next()).intValue();
            sb.append(StringUtil.getLeftPaddedStr(String.valueOf(kills), '0', 3));
        }
        mplew.writeMapleAsciiString(sb.toString());

        return mplew.getPacket();
    }

    public static byte[] getShowQuestCompletion(int id) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_QUEST_COMPLETION.getValue());
        mplew.writeShort(id);

        return mplew.getPacket();
    }

    public static byte[] getKeymap(MapleKeyLayout layout, int 职业) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.KEYMAP.getValue());

        layout.writeData(mplew, 职业);

        return mplew.getPacket();
    }

    public static byte[] 宠物自动HP(int itemId) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PET_AUTO_HP.getValue());
        mplew.writeInt(itemId);

        return mplew.getPacket();
    }

    public static byte[] 宠物自动MP(int itemId) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PET_AUTO_MP.getValue());
        mplew.writeInt(itemId);

        return mplew.getPacket();
    }

    public static byte[] 宠物自动Buff(int skillId) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PET_AUTO_BUFF.getValue());
        mplew.writeInt(skillId);

        return mplew.getPacket();
    }

    public static byte[] 悄悄话_获取(String sender, int channel, String text) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.WHISPER.getValue());
        mplew.write(18);
        mplew.writeMapleAsciiString(sender);
        mplew.writeShort(channel - 1);
        mplew.writeMapleAsciiString(text);

        return mplew.getPacket();
    }

    public static byte[] 悄悄话_获取回复(String target, byte reply) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.WHISPER.getValue());
        mplew.write(10);
        mplew.writeMapleAsciiString(target);
        mplew.write(reply);

        return mplew.getPacket();
    }

    public static byte[] getFindReplyWithMap(String target, int mapid, boolean buddy) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.WHISPER.getValue());
        mplew.write(buddy ? 72 : 9);
        mplew.writeMapleAsciiString(target);
        mplew.write(1);
        mplew.writeInt(mapid);
        mplew.writeZeroBytes(8);

        return mplew.getPacket();
    }

    public static byte[] getFindReply(String target, int channel, boolean buddy) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.WHISPER.getValue());
        mplew.write(buddy ? 72 : 9);
        mplew.writeMapleAsciiString(target);
        mplew.write(3);
        mplew.writeInt(channel - 1);

        return mplew.getPacket();
    }

    public static byte[] getInventoryFull() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(1);
        mplew.writeShort(0);

        return mplew.getPacket();
    }

    public static byte[] getInventoryStatus() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MODIFY_INVENTORY_ITEM.getValue());
        mplew.write(0);
        mplew.writeShort(0);

        return mplew.getPacket();
    }

    public static byte[] getShowInventoryFull() {
        return getShowInventoryStatus(255);
    }

    public static byte[] showItemUnavailable() {
        return getShowInventoryStatus(254);
    }

    public static byte[] getShowInventoryStatus(int mode) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(0);
        mplew.write(mode);

        return mplew.getPacket();
    }

    public static byte[] 打开钓鱼仓库(int npcId, byte slots) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.FISHING_STORE.getValue());
        mplew.write(33);
        mplew.writeLong(-1L);
        mplew.write(slots);
        mplew.writeLong(0L);
        mplew.writeInt(npcId);
        return mplew.getPacket();
    }

    public static byte[] 获取仓库(int npcId, byte slots, Collection<Item> items, long meso) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.OPEN_STORAGE.getValue());
        mplew.write(22);
        mplew.writeInt(npcId);
        mplew.write(slots);
        mplew.writeLong(126L);
        mplew.writeLong(meso);

        mplew.write(items.size());
        for (Item item : items) {
            PacketHelper.addItemInfo(mplew, item, true, true);
        }
        mplew.writeInt(0);

        return mplew.getPacket();
    }

    public static byte[] 获取仓库错误(byte op) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.OPEN_STORAGE.getValue());
        mplew.write(op);

        return mplew.getPacket();
    }

    public static byte[] 仓库金币(byte slots, long meso) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.OPEN_STORAGE.getValue());

        mplew.write(19);
        mplew.write(slots);
        mplew.writeLong(2L);
        mplew.writeLong(meso);

        return mplew.getPacket();
    }

    public static byte[] arrangeStorage(byte slots, Collection<Item> items, boolean changed) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.OPEN_STORAGE.getValue());
        mplew.write(15);
        mplew.write(slots);
        mplew.writeLong(124L);

        mplew.write(items.size());
        for (Item item : items) {
            PacketHelper.addItemInfo(mplew, item, true, true);
        }
        mplew.writeInt(0);
        return mplew.getPacket();
    }

    public static byte[] storeStorage(byte slots, MapleInventoryType type, Collection<Item> items) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.OPEN_STORAGE.getValue());
        mplew.write(13);
        mplew.write(slots);
        mplew.writeLong(type.getBitfieldEncoding());
        mplew.write(items.size());
        for (Item item : items) {
            PacketHelper.addItemInfo(mplew, item, true, true);
        }
        return mplew.getPacket();
    }

    public static byte[] 取出仓库物品(byte slots, MapleInventoryType type, Collection<Item> items) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.OPEN_STORAGE.getValue());
        mplew.write(9);
        mplew.write(slots);
        mplew.writeLong(type.getBitfieldEncoding());
        mplew.write(items.size());
        for (Item item : items) {
            PacketHelper.addItemInfo(mplew, item, true, true);
        }
        return mplew.getPacket();
    }

    public static byte[] fairyPendantMessage(int position, int percent) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.FAIRY_PEND_MSG.getValue());
        mplew.writeInt(position);
        mplew.writeInt(0);
        mplew.writeInt(percent);

        return mplew.getPacket();
    }

    public static byte[] 人气_我给别人加(int mode, String charname, int newfame) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.FAME_RESPONSE.getValue());
        mplew.write(0);
        mplew.writeMapleAsciiString(charname);
        mplew.write(mode);
        mplew.writeInt(newfame);
        // mplew.writeShort(0);

        return mplew.getPacket();
    }

    public static byte[] 人气_我给别人加_错误(int status) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.FAME_RESPONSE.getValue());
        mplew.write(status);

        return mplew.getPacket();
    }

    public static byte[] 人气_别人给我加(int mode, String charnameFrom) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.FAME_RESPONSE.getValue());
        mplew.write(5);
        mplew.writeMapleAsciiString(charnameFrom);
        mplew.write(mode);

        return mplew.getPacket();
    }

    public static byte[] multiChat(String name, String chattext, int mode) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MULTICHAT.getValue());
        mplew.write(mode);
        mplew.writeMapleAsciiString(name);
        mplew.writeMapleAsciiString(chattext);

        return mplew.getPacket();
    }

    public static byte[] getClock(int time) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CLOCK.getValue());
        mplew.write(2);
        mplew.writeInt(time);

        return mplew.getPacket();
    }

    public static byte[] getClockTime(int hour, int min, int sec) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CLOCK.getValue());
        mplew.write(1);
        mplew.write(hour);
        mplew.write(min);
        mplew.write(sec);

        return mplew.getPacket();
    }

    public static byte[] spawnMist(MapleMist mist) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPAWN_MIST.getValue());
        mplew.writeInt(mist.getObjectId());
        mplew.writeInt(mist.isMobMist() ? 0 : mist.isPoisonMist());
        mplew.writeInt(mist.getOwnerId());
        if (mist.getMobSkill() == null) {
            mplew.writeInt(mist.getSourceSkill().getId());
        } else {
            mplew.writeInt(mist.getMobSkill().getSkillId());
        }
        mplew.write(mist.getSkillLevel());
        mplew.writeShort(mist.getSkillDelay());
        mplew.writeRect(mist.getBox());

        if ((mist.getSourceSkill().getId() == 32121006) || (mist.getSourceSkill().getId() == 2311011) || (mist.getSourceSkill().getId() == 100001261)) {
            mplew.writeInt(0);
            mplew.writeInt(12255149);
            mplew.writeInt(0);
        } else if (mist.getSourceSkill().getId() == 13120007) {
            mplew.writeInt(0);
            mplew.writeInt(9109633);
        } else if ((mist.getSourceSkill().getId() == 22161003) || (mist.getSourceSkill().getId() == 4221006) || (mist.getSourceSkill().getId() == 35121010) || (mist.getSourceSkill().getId() == 2111003)) {
            mplew.writeInt(0);
            mplew.writeInt(6748489);
            mplew.writeInt(0);
        } else if (mist.getMobSkill() != null) {
            if (mist.getMobSkill().getSkillId() == 32121006) {
                mplew.writeInt(0);
                mplew.writeInt(12255149);
                mplew.writeInt(0);
            } else if (mist.getMobSkill().getSkillId() == 13111024) {
                mplew.writeInt(0);
                mplew.writeInt(9109633);
            } else if (mist.getMobSkill().getSkillId() == 4121015) {
                mplew.writeInt(0);
                mplew.writeInt(8585267);
                mplew.writeInt(0);
            }

        }

        mplew.writeLong(0L);
        return mplew.getPacket();
    }

    public static byte[] removeMist(int oid, boolean eruption) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.REMOVE_MIST.getValue());
        mplew.writeInt(oid);
        if (eruption == true) {
            mplew.write(1);
        }

        return mplew.getPacket();
    }

    public static byte[] spawnLove(int oid, int itemid, String name, String msg, Point pos, int ft) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPAWN_LOVE.getValue());
        mplew.writeInt(oid);
        mplew.writeInt(itemid);
        mplew.writeMapleAsciiString(msg);
        mplew.writeMapleAsciiString(name);
        mplew.writeShort(pos.x);
        mplew.writeShort(pos.y + ft);

        return mplew.getPacket();
    }

    public static byte[] removeLove(int oid, int itemid) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.REMOVE_LOVE.getValue());
        mplew.writeInt(oid);
        mplew.writeInt(itemid);

        return mplew.getPacket();
    }

    public static byte[] damageSummon(int cid, int summonSkillId, int damage, int unkByte, int monsterIdFrom) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.DAMAGE_SUMMON.getValue());
        mplew.writeInt(cid);
        mplew.writeInt(summonSkillId);
        mplew.write(unkByte);
        mplew.writeInt(damage);
        mplew.writeInt(monsterIdFrom);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] 物品效果(int characterid, int itemid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_EFFECT.getValue());
        mplew.writeInt(characterid);
        mplew.writeInt(itemid);

        return mplew.getPacket();
    }

    public static byte[] 显示头上称号(int characterid, int itemid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_TITLE_EFFECT.getValue());
        mplew.writeInt(characterid);
        mplew.writeInt(itemid);

        return mplew.getPacket();
    }

    public static byte[] 显示椅子(int characterid, int itemid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_CHAIR.getValue());
        mplew.writeInt(characterid);
        mplew.writeInt(itemid);
        mplew.writeInt(0);
        mplew.writeInt(0);

        return mplew.getPacket();
    }

    public static byte[] 取消椅子(int characterid,int id) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CANCEL_CHAIR.getValue());
        if (id == -1) {
            mplew.writeInt(characterid);
            mplew.write(0);
        } else {
            
            mplew.writeInt(characterid);
            mplew.write(0);
        }
        return mplew.getPacket();
    }

    public static byte[] 反应堆_召唤(MapleReactor reactor) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }

        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.REACTOR_SPAWN.getValue());
        mplew.writeInt(reactor.getObjectId());
        mplew.writeInt(reactor.getReactorId());
        mplew.write(reactor.getState());
        mplew.writePos(reactor.getTruePosition());
        mplew.write(reactor.getFacingDirection());
        mplew.writeMapleAsciiString(reactor.getName());

        return mplew.getPacket();
    }

    public static byte[] 反应堆_触发(MapleReactor reactor, int stance) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.REACTOR_HIT.getValue());
        mplew.writeInt(reactor.getObjectId());
        mplew.write(reactor.getState());
        mplew.writePos(reactor.getTruePosition());
        mplew.writeInt(stance);
        return mplew.getPacket();
    }

    public static byte[] 反应堆_重置(MapleReactor reactor) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.REACTOR_DESTROY.getValue());
        mplew.writeInt(reactor.getObjectId());
        mplew.write(reactor.getState());
        mplew.writePos(reactor.getPosition());

        return mplew.getPacket();
    }

    public static byte[] musicChange(String song) {
        return environmentChange(song, 7);
    }

    public static byte[] showEffect(String effect) {
        return environmentChange(effect, 12);
    }

    public static byte[] playSound(String sound) {
        return environmentChange(sound, 4);
    }

    public static byte[] environmentChange(String env, int mode) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.BOSS_ENV.getValue());
        mplew.write(mode);
        mplew.writeMapleAsciiString(env);

        return mplew.getPacket();
    }

    public static byte[] environmentMove(String env, int mode) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MOVE_ENV.getValue());
        mplew.writeMapleAsciiString(env);
        mplew.writeInt(mode);

        return mplew.getPacket();
    }

    public static byte[] startMapEffect(String msg, int itemid, boolean active) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MAP_EFFECT.getValue());
        mplew.write(active ? 0 : 1);
        mplew.writeInt(itemid);
        if (active) {
            mplew.writeMapleAsciiString(msg);
        }
        return mplew.getPacket();
    }

    public static byte[] removeMapEffect() {
        return startMapEffect(null, 0, false);
    }

    public static byte[] skillEffect(MapleCharacter from, int skillId, byte level, byte flags, byte speed, byte unk) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SKILL_EFFECT.getValue());
        mplew.writeInt(from.getId());
        mplew.writeInt(skillId);
        if (GameConstants.isMagicChargeSkill(skillId)) {
            mplew.write(level);
            mplew.write(-1);
            mplew.write(flags);
            mplew.write(speed);
        } else {
            mplew.write(level);
            mplew.write(flags);
            mplew.write(speed);
            mplew.write(unk);
            mplew.write(GameConstants.isMagicChargeSkill(skillId) ? 20 : 31);
            mplew.write(-1);
            mplew.writeShort(0);
        }

        return mplew.getPacket();
    }

    public static byte[] skillCancel(MapleCharacter from, int skillId) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CANCEL_SKILL_EFFECT.getValue());
        mplew.writeInt(from.getId());
        mplew.writeInt(skillId);

        return mplew.getPacket();
    }

    public static byte[] showMagnet(int mobid, byte success, int skillId) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_MAGNET.getValue());
        mplew.writeInt(mobid);
        mplew.write(success);
        if (skillId == 30001061) {
            mplew.write(1);
        }

            return mplew.getPacket();
    }

public static byte[] 玩家头顶提示(String hint, int width, int height) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (width < 1) {
            width = hint.length() * 10;
            if (width < 40) {
                width = 40;
            }
        }
        if (height < 5) {
            height = 5;
        }
        mplew.writeShort(SendPacketOpcode.PLAYER_HINT.getValue());
        mplew.writeMapleAsciiString(hint);
        mplew.writeShort(width);
        mplew.writeShort(height);
        mplew.write(1);

        return mplew.getPacket();
    }

    public static byte[] messengerInvite(String from, int messengerid) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MESSENGER.getValue());
        mplew.write(3);
        mplew.writeMapleAsciiString(from);
        mplew.write(7);
        mplew.writeInt(messengerid);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] 聊天招待_添加玩家(String from, MapleCharacter chr, int position, int channel) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MESSENGER.getValue());
        mplew.write(0);
        mplew.write(position);
        PacketHelper.addCharLook(mplew, chr, true, false, true);
        mplew.writeMapleAsciiString(from);
        mplew.writeShort(channel);

        return mplew.getPacket();
    }

    public static byte[] 聊天招待_移除玩家(int position) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MESSENGER.getValue());
        mplew.write(2);
        mplew.write(position);

        return mplew.getPacket();
    }

    public static byte[] 聊天招待_更新玩家(String from, MapleCharacter chr, int position, int channel) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MESSENGER.getValue());
        mplew.write(7);
        mplew.write(position);
        PacketHelper.addCharLook(mplew, chr, true, false, true);
        mplew.writeMapleAsciiString(from);
        mplew.writeShort(channel);

        return mplew.getPacket();
    }

    public static byte[] 聊天招待_加入(int position) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MESSENGER.getValue());
        mplew.write(1);
        mplew.write(position);

        return mplew.getPacket();
    }

    public static byte[] 聊天招待_信息(String text) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MESSENGER.getValue());
        mplew.write(6);
        mplew.writeMapleAsciiString(text);

        return mplew.getPacket();
    }

    public static byte[] 聊天招待_Note(String text, int mode, int mode2) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MESSENGER.getValue());
        mplew.write(mode);
        mplew.writeMapleAsciiString(text);
        mplew.write(mode2);

        return mplew.getPacket();
    }

    public static byte[] getFindReplyWithCS(String target, boolean buddy) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.WHISPER.getValue());
        mplew.write(buddy ? 72 : 9);
        mplew.writeMapleAsciiString(target);
        mplew.write(2);
        mplew.writeInt(-1);

        return mplew.getPacket();
    }

    public static byte[] getFindReplyWithMTS(String target, boolean buddy) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.WHISPER.getValue());
        mplew.write(buddy ? 72 : 9);
        mplew.writeMapleAsciiString(target);
        mplew.write(0);
        mplew.writeInt(-1);

        return mplew.getPacket();
    }

    public static byte[] 显示装备效果() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_EQUIP_EFFECT.getValue());

        return mplew.getPacket();
    }

    public static byte[] 显示装备效果(int team) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_EQUIP_EFFECT.getValue());
        mplew.writeShort(team);
        return mplew.getPacket();
    }

    public static byte[] summonSkill(int cid, int summonSkillId, int newStance) {
        if (ServerProperties.ShowPacket());
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SUMMON_SKILL.getValue());
        mplew.writeInt(cid);
        mplew.writeInt(summonSkillId);
        mplew.write(newStance);

        return mplew.getPacket();
    }

    public static byte[] 技能冷却时间(int sid, int time) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.COOLDOWN.getValue());
        mplew.writeInt(sid);
        mplew.writeInt(time);

        return mplew.getPacket();
    }

    public static byte[] 使用技能书(MapleCharacter chr, int skillid, int maxlevel, boolean canuse, boolean success) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.USE_SKILL_BOOK.getValue());
        mplew.write(0);
        mplew.writeInt(chr.getId());
        mplew.write(1);
       // mplew.writeInt(skillid);
        //mplew.writeInt(maxlevel);
        mplew.writeInt(0);
        mplew.writeInt(0);   
        mplew.write(canuse ? 1 : 0);
        mplew.write(success ? 1 : 0);

        return mplew.getPacket();
    }

    public static byte[] 获取宏技能(SkillMacro[] macros) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SKILL_MACRO.getValue());
        int count = 0;
        for (int i = 0; i < 5; i++) {
            if (macros[i] != null) {
                count++;
            }
        }
        mplew.write(count);
        for (int i = 0; i < 5; i++) {
            SkillMacro macro = macros[i];
            if (macro != null) {
                mplew.writeMapleAsciiString(macro.getName());
                mplew.write(macro.getShout());
                mplew.writeInt(macro.getSkill1());
                mplew.writeInt(macro.getSkill2());
                mplew.writeInt(macro.getSkill3());
            }
        }
        return mplew.getPacket();
    }

    public static byte[] updateAriantPQRanking(String name, int score, boolean empty) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.ARIANT_PQ_START.getValue());
        mplew.write(empty ? 0 : 1);
        if (!empty) {
            mplew.writeMapleAsciiString(name);
            mplew.writeInt(score);
        }
        return mplew.getPacket();
    }

    public static byte[] catchMonster(int mobid, int itemid, byte success) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CATCH_MONSTER.getValue());
        mplew.writeInt(mobid);
        mplew.writeInt(itemid);
        mplew.write(success);

        return mplew.getPacket();
    }

    public static byte[] catchMob(int mobid, int itemid, byte success) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CATCH_MOB.getValue());
        mplew.write(success);
        mplew.writeInt(itemid);
        mplew.writeInt(mobid);

        return mplew.getPacket();
    }

    public static byte[] showAriantScoreBoard() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.ARIANT_SCOREBOARD.getValue());

        return mplew.getPacket();
    }

    public static byte[] boatPacket(int effect) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.BOAT_EFFECT.getValue());
        mplew.writeShort(effect);

        return mplew.getPacket();
    }

    public static byte[] boatEffect(int effect) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.BOAT_EFF.getValue());
        mplew.writeShort(effect);

        return mplew.getPacket();
    }

    public static byte[] removeItemFromDuey(boolean remove, int Package) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.DUEY.getValue());
        mplew.write(24);
        mplew.writeInt(Package);
        mplew.write(remove ? 3 : 4);

        return mplew.getPacket();
    }

    public static byte[] sendDuey(byte operation, List<MapleDueyActions> packages) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.DUEY.getValue());
        mplew.write(operation);

        switch (operation) {
            case 9:
                mplew.write(1);

                break;
            case 10:
                mplew.write(0);
                mplew.write(packages.size());

                for (MapleDueyActions dp : packages) {
                    mplew.writeInt(dp.getPackageId());
                    mplew.writeAsciiString(dp.getSender(), 13);
                    mplew.writeInt(dp.getMesos());
                    mplew.writeLong(PacketHelper.getTime(dp.getSentTime()));
                    mplew.writeZeroBytes(205);

                    if (dp.getItem() != null) {
                        mplew.write(1);
                        PacketHelper.addItemInfo(mplew, dp.getItem(), true, true);
                    } else {
                        mplew.write(0);
                    }
                }

                mplew.write(0);
        }

        return mplew.getPacket();
    }

    public static byte[] 冒险岛TV_启用() {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.ENABLE_TV.getValue());
        mplew.writeInt(0);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] 冒险岛TV_移除() {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.REMOVE_TV.getValue());

        return mplew.getPacket();
    }

    public static byte[] 冒险岛TV_显示(MapleCharacter chr, List<String> messages, int type, MapleCharacter partner, int delay) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.START_TV.getValue());
        mplew.write(partner != null ? 2 : 1);
        mplew.write(type);
        PacketHelper.addCharLook(mplew, chr, false, false, false);
        mplew.writeMapleAsciiString(chr.getName());

        if (partner != null) {
            mplew.writeMapleAsciiString(partner.getName());
        } else {
            mplew.writeShort(0);
        }
        for (int i = 0; i < messages.size(); i++) {
            if ((i == 4) && (((String) messages.get(4)).length() > 15)) {
                mplew.writeMapleAsciiString(((String) messages.get(4)).substring(0, 15));
            } else {
                mplew.writeMapleAsciiString((String) messages.get(i));
            }
        }
        mplew.writeInt(delay);
        if (partner != null) {
            PacketHelper.addCharLook(mplew, partner, false, false, false);
        }
        return mplew.getPacket();
    }

    public static byte[] Mulung_DojoUp2() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
        mplew.write(11);

        return mplew.getPacket();
    }

    public static byte[] showQuestMsg(String msg) {
        return serverNotice(5, msg);
    }

    public static byte[] Mulung_Pts(int recv, int total) {
        return showQuestMsg(new StringBuilder().append("获得了 ").append(recv).append(" 点修炼点数。总修炼点数为 ").append(total).append(" 点。").toString());
    }

    public static byte[] showOXQuiz(int questionSet, int questionId, boolean askQuestion) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.OX_QUIZ.getValue());
        mplew.write(askQuestion ? 1 : 0);
        mplew.write(questionSet);
        mplew.writeShort(questionId);
        return mplew.getPacket();
    }

    public static byte[] leftKnockBack() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.LEFT_KNOCK_BACK.getValue());
        return mplew.getPacket();
    }

    public static byte[] rollSnowball(int type, MapleSnowball.MapleSnowballs ball1, MapleSnowball.MapleSnowballs ball2) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.ROLL_SNOWBALL.getValue());
        mplew.write(type);
        mplew.writeInt(ball1 == null ? 0 : ball1.getSnowmanHP() / 75);
        mplew.writeInt(ball2 == null ? 0 : ball2.getSnowmanHP() / 75);
        mplew.writeShort(ball1 == null ? 0 : ball1.getPosition());
        mplew.write(0);
        mplew.writeShort(ball2 == null ? 0 : ball2.getPosition());
        mplew.writeZeroBytes(11);
        return mplew.getPacket();
    }

    public static byte[] enterSnowBall() {
        return rollSnowball(0, null, null);
    }

    public static byte[] hitSnowBall(int team, int damage, int distance, int delay) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.HIT_SNOWBALL.getValue());
        mplew.write(team);
        mplew.writeShort(damage);
        mplew.write(distance);
        mplew.write(delay);
        return mplew.getPacket();
    }

    public static byte[] snowballMessage(int team, int message) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.SNOWBALL_MESSAGE.getValue());
        mplew.write(team);
        mplew.writeInt(message);
        return mplew.getPacket();
    }

    public static byte[] finishedSort(int type) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }

        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.FINISH_SORT.getValue());
        mplew.write(1);
        mplew.write(type);
        return mplew.getPacket();
    }

    public static byte[] coconutScore(int[] coconutscore) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.COCONUT_SCORE.getValue());
        mplew.writeShort(coconutscore[0]);
        mplew.writeShort(coconutscore[1]);
        return mplew.getPacket();
    }

    public static byte[] 攻击椰子(boolean spawn, int id, int type) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.HIT_COCONUT.getValue());
        if (spawn) {
            mplew.write(0);
            mplew.writeInt(128);
        } else {
            mplew.writeInt(id);
            mplew.write(type);
        }
        return mplew.getPacket();
    }

    public static byte[] finishedGather(int type) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }

        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.FINISH_GATHER.getValue());
        mplew.write(1);
        mplew.write(type);
        return mplew.getPacket();
    }

    public static byte[] yellowChat(String msg) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPOUSE_MESSAGE.getValue());
        mplew.writeShort(7);
        mplew.writeMapleAsciiString(msg);
        return mplew.getPacket();
    }

    public static byte[] getPeanutResult(int itemId, short quantity, int itemId2, short quantity2, int ourItem) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PIGMI_REWARD.getValue());
        mplew.writeInt(itemId);
        mplew.writeShort(quantity);
        mplew.writeInt(ourItem);
        mplew.writeInt(itemId2);
        mplew.writeInt(quantity2);

        return mplew.getPacket();
    }

    public static byte[] 提示_升级(boolean family, int level, String name) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.LEVEL_UPDATE.getValue());
        mplew.write(family ? 1 : 2);
        mplew.writeInt(level);
        mplew.writeMapleAsciiString(name);

        return mplew.getPacket();
    }

    public static byte[] 提示_结婚(boolean family, String name) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MARRIAGE_UPDATE.getValue());
        mplew.write(family ? 1 : 0);
        mplew.writeMapleAsciiString(name);

        return mplew.getPacket();
    }

    public static byte[] 提示_转职(boolean family, int jobid, String name) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.JOB_UPDATE.getValue());
        mplew.write(family ? 1 : 0);
        mplew.writeInt(jobid);
        mplew.writeMapleAsciiString(new StringBuilder().append((GameConstants.GMS) && (!family) ? "> " : "").append(name).toString());

        return mplew.getPacket();
    }

    public static byte[] showHorntailShrine(boolean spawned, int time) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.HORNTAIL_SHRINE.getValue());
        mplew.write(spawned ? 1 : 0);
        mplew.writeInt(time);
        return mplew.getPacket();
    }

    public static byte[] showChaosZakumShrine(boolean spawned, int time) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.CHAOS_ZAKUM_SHRINE.getValue());
        mplew.write(spawned ? 1 : 0);
        mplew.writeInt(time);
        return mplew.getPacket();
    }

    public static byte[] showChaosHorntailShrine(boolean spawned, int time) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.CHAOS_HORNTAIL_SHRINE.getValue());
        mplew.write(spawned ? 1 : 0);
        mplew.writeInt(time);
        return mplew.getPacket();
    }

    public static byte[] 时钟停止() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.STOP_CLOCK.getValue());

        return mplew.getPacket();
    }

    public static byte[] spawnDragon(MapleDragon d) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.DRAGON_SPAWN.getValue());
        mplew.writeInt(d.getOwner());
        mplew.writeInt(d.getPosition().x);
        mplew.writeInt(d.getPosition().y);
        mplew.write(d.getStance());
        mplew.writeShort(0);
        mplew.writeShort(d.getJobId());
        return mplew.getPacket();
    }

    public static byte[] removeDragon(int chrid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.DRAGON_REMOVE.getValue());
        mplew.writeInt(chrid);
        return mplew.getPacket();
    }

    public static byte[] moveDragon(MapleDragon d, Point startPos, List<LifeMovementFragment> moves) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.DRAGON_MOVE.getValue());
        mplew.writeInt(d.getOwner());
        mplew.writeInt(0);
        mplew.writePos(startPos);
        mplew.writeInt(0);

        PacketHelper.serializeMovementList(mplew, moves);

        return mplew.getPacket();
    }

    public static byte[] temporaryStats_Aran() {
        Map stats = new EnumMap(MapleStat.Temp.class);
        stats.put(MapleStat.Temp.力量, Integer.valueOf(999));
        stats.put(MapleStat.Temp.敏捷, Integer.valueOf(999));
        stats.put(MapleStat.Temp.智力, Integer.valueOf(999));
        stats.put(MapleStat.Temp.运气, Integer.valueOf(999));
        stats.put(MapleStat.Temp.物攻, Integer.valueOf(255));
        stats.put(MapleStat.Temp.命中, Integer.valueOf(999));
        stats.put(MapleStat.Temp.回避, Integer.valueOf(999));
        stats.put(MapleStat.Temp.速度, Integer.valueOf(140));
        stats.put(MapleStat.Temp.跳跃, Integer.valueOf(120));
        return temporaryStats(stats);
    }

    public static byte[] temporaryStats_Balrog(MapleCharacter chr) {
        Map stats = new EnumMap(MapleStat.Temp.class);
        int offset = 1 + (chr.getLevel() - 90) / 20;

        stats.put(MapleStat.Temp.力量, Integer.valueOf(chr.getStat().getTotalStr() / offset));
        stats.put(MapleStat.Temp.敏捷, Integer.valueOf(chr.getStat().getTotalDex() / offset));
        stats.put(MapleStat.Temp.智力, Integer.valueOf(chr.getStat().getTotalInt() / offset));
        stats.put(MapleStat.Temp.运气, Integer.valueOf(chr.getStat().getTotalLuk() / offset));
        stats.put(MapleStat.Temp.物攻, Integer.valueOf(chr.getStat().getTotalWatk() / offset));
        stats.put(MapleStat.Temp.物防, Integer.valueOf(chr.getStat().getTotalMagic() / offset));
        return temporaryStats(stats);
    }

    public static byte[] temporaryStats(Map<MapleStat.Temp, Integer> mystats) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.TEMP_STATS.getValue());

        int updateMask = 0;
        for (MapleStat.Temp statupdate : mystats.keySet()) {
            updateMask |= statupdate.getValue();
        }
        mplew.writeInt(updateMask);

        for (Map.Entry statupdate : mystats.entrySet()) {
            Integer value = Integer.valueOf(((MapleStat.Temp) statupdate.getKey()).getValue());

            if (value.intValue() >= 1) {
                if (value.intValue() <= 512) {
                    mplew.writeShort(((Integer) statupdate.getValue()).shortValue());
                } else {
                    mplew.write(((Integer) statupdate.getValue()).byteValue());
                }
            }
        }
        return mplew.getPacket();
    }

    public static byte[] temporaryStats_Reset() {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        
        mplew.writeShort(SendPacketOpcode.TEMP_STATS_RESET.getValue());
        return mplew.getPacket();
    }

    public static byte[] showHpHealed(int cid, int amount) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.SHOW_FOREIGN_EFFECT.getValue());
        mplew.writeInt(cid);
        mplew.write(12);
        mplew.writeInt(amount);
        return mplew.getPacket();
    }

    public static byte[] showOwnHpHealed(int amount) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
        mplew.write(12);
        mplew.writeInt(amount);
        return mplew.getPacket();
    }

    public static byte[] sendPartyWindow(int npc) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.REPAIR_WINDOW.getValue());

        mplew.writeInt(21);
        mplew.writeInt(npc);
        mplew.writeInt(0);
        return mplew.getPacket();
    }

    public static byte[] sendRepairWindow(int npc) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.REPAIR_WINDOW.getValue());

        mplew.writeInt(33);
        mplew.writeInt(npc);
        mplew.writeInt(0);
        return mplew.getPacket();
    }

    public static byte[] sendProfessionWindow(int npc) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.REPAIR_WINDOW.getValue());

        mplew.writeInt(42);
        mplew.writeInt(npc);
        mplew.writeInt(0);
        return mplew.getPacket();
    }

    public static byte[] sendPVPWindow(int npc) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.PVP_WINDOW.getValue());
        mplew.writeInt(50);
        if (npc > 0) {
            mplew.writeInt(npc);
        }
        return mplew.getPacket();
    }

    public static byte[] sendEventWindow(int npc) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.PVP_WINDOW.getValue());
        mplew.writeInt(55);
        if (npc > 0) {
            mplew.writeInt(npc);
        }

        return mplew.getPacket();
    }

    public static byte[] sendPVPMaps() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.PVP_INFO.getValue());
        mplew.write(1);
        mplew.writeInt(0);
        for (int i = 0; i < 3; i++) {
            mplew.writeInt(1);
        }
        mplew.writeLong(0L);
        for (int i = 0; i < 3; i++) {
            mplew.writeInt(1);
        }
        mplew.writeLong(0L);
        for (int i = 0; i < 4; i++) {
            mplew.writeInt(1);
        }
        for (int i = 0; i < 10; i++) {
            mplew.writeInt(1);
        }
        mplew.writeInt(14);
        mplew.writeShort(100);
        mplew.write(0);
        return mplew.getPacket();
    }

    public static byte[] sendPyramidUpdate(int amount) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.PYRAMID_UPDATE.getValue());
        mplew.writeInt(amount);
        return mplew.getPacket();
    }

    public static byte[] sendPyramidResult(byte rank, int amount) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.PYRAMID_RESULT.getValue());
        mplew.write(rank);
        mplew.writeInt(amount);
        return mplew.getPacket();
    }

    public static byte[] sendPyramidEnergy(String type, String amount) {
        return sendString(1, type, amount);
    }

    public static byte[] sendString(int type, String object, String amount) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        switch (type) {
            case 1:
                mplew.writeShort(SendPacketOpcode.ENERGY.getValue());
                break;
            case 2:
                mplew.writeShort(SendPacketOpcode.GHOST_POINT.getValue());
                break;
            case 3:
                mplew.writeShort(SendPacketOpcode.GHOST_STATUS.getValue());
        }

        mplew.writeMapleAsciiString(object);
        mplew.writeMapleAsciiString(amount);
        return mplew.getPacket();
    }

    public static byte[] sendGhostPoint(String type, String amount) {
        return sendString(2, type, amount);
    }

    public static byte[] sendGhostStatus(String type, String amount) {
        return sendString(3, type, amount);
    }

    public static byte[] MulungEnergy(int energy) {
        return sendPyramidEnergy("energy", String.valueOf(energy));
    }

    public static byte[] getPollQuestion() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GAME_POLL_QUESTION.getValue());
        mplew.writeInt(1);
        mplew.writeInt(14);
        mplew.writeMapleAsciiString(ServerConstants.Poll_Question);
        mplew.writeInt(ServerConstants.Poll_Answers.length);
        for (byte i = 0; i < ServerConstants.Poll_Answers.length; i = (byte) (i + 1)) {
            mplew.writeMapleAsciiString(ServerConstants.Poll_Answers[i]);
        }

        return mplew.getPacket();
    }

    public static byte[] getPollReply(String message) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GAME_POLL_REPLY.getValue());
        mplew.writeMapleAsciiString(message);

        return mplew.getPacket();
    }

    public static byte[] 获取龙神教程(String data) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.NPC_TALK.getValue());

        mplew.write(8);
        mplew.writeInt(0);
        mplew.write(1);
        mplew.write(1);
        mplew.write(1);
        mplew.writeMapleAsciiString(data);

        return mplew.getPacket();
    }

    public static byte[] showEventInstructions() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.GMEVENT_INSTRUCTIONS.getValue());
        mplew.write(0);
        return mplew.getPacket();
    }

    public static byte[] 获取商店搜索器() {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.OWL_OF_MINERVA.getValue());
        mplew.write(9);
        mplew.write(GameConstants.owlItems.length);
        for (int i : GameConstants.owlItems) {
            mplew.writeInt(i);
        }
        return mplew.getPacket();
    }

    public static byte[] 获取商店搜索器结果(int itemSearch, List<HiredMerchant> hms) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.OWL_OF_MINERVA.getValue());
        mplew.write(8);
        mplew.writeInt(0);
        mplew.writeInt(itemSearch);
        int size = 0;

        for (HiredMerchant hm : hms) {
            size += hm.searchItem(itemSearch).size();
        }
        mplew.writeInt(size);
        for (Iterator i = hms.iterator(); i.hasNext();) {
            HiredMerchant hm = (HiredMerchant) i.next();
            List<MaplePlayerShopItem> items = hm.searchItem(itemSearch);
            for (MaplePlayerShopItem item : items) {
                mplew.writeMapleAsciiString(hm.getOwnerName());
                mplew.writeInt(hm.getMap().getId());
                mplew.writeMapleAsciiString(hm.getDescription());
                mplew.writeInt(item.item.getQuantity());
                mplew.writeInt(item.bundles);
                mplew.writeLong(item.price);
                switch (1) {
                    case 0:
                        mplew.writeInt(hm.getOwnerId());
                        break;
                    case 1:
                        mplew.writeInt(hm.getStoreId());
                        break;
                    default:
                        mplew.writeInt(hm.getObjectId());
                }

                mplew.write(hm.getFreeSlot() == -1 ? 1 : 0);
                mplew.write(GameConstants.getInventoryType(itemSearch).getType());
                if (GameConstants.getInventoryType(itemSearch) == MapleInventoryType.EQUIP) {
                    PacketHelper.addItemInfo(mplew, item.item, true, true);
                }
            }
        }
        HiredMerchant hm;
        return mplew.getPacket();
    }

    public static byte[] getRPSMode(byte mode, int mesos, int selection, int answer) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.RPS_GAME.getValue());
        mplew.write(mode);
        switch (mode) {
            case 6:
                if (mesos != -1) {
                    mplew.writeInt(mesos);
                }
                break;
            case 8:
                mplew.writeInt(9000019);
                break;
            case 11:
                mplew.write(selection);
                mplew.write(answer);
        }

        return mplew.getPacket();
    }

    public static byte[] getSlotUpdate(byte invType, byte newSlots) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.UPDATE_INVENTORY_SLOT.getValue());
        mplew.write(invType);
        mplew.write(newSlots);
        return mplew.getPacket();
    }

    public static byte[] followRequest(int chrid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.FOLLOW_REQUEST.getValue());
        mplew.writeInt(chrid);
        return mplew.getPacket();
    }

    public static byte[] followEffect(int initiator, int replier, Point toMap) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.FOLLOW_EFFECT.getValue());
        mplew.writeInt(initiator);
        mplew.writeInt(replier);
        if (replier == 0) {
            mplew.write(toMap == null ? 0 : 1);
            if (toMap != null) {
                mplew.writeInt(toMap.x);
                mplew.writeInt(toMap.y);
            }
        }
        return mplew.getPacket();
    }

    public static byte[] getFollowMsg(int opcode) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.FOLLOW_MSG.getValue());

        mplew.writeLong(opcode);
        return mplew.getPacket();
    }

    public static byte[] moveFollow(Point otherStart, Point myStart, Point otherEnd, List<LifeMovementFragment> moves) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.FOLLOW_MOVE.getValue());
        mplew.writePos(otherStart);
        mplew.writePos(myStart);
        PacketHelper.serializeMovementList(mplew, moves);
        mplew.write(17);
        for (int i = 0; i < 8; i++) {
            mplew.write(0);
        }
        mplew.write(0);
        mplew.writePos(otherEnd);
        mplew.writePos(otherStart);

        return mplew.getPacket();
    }

    public static byte[] getFollowMessage(String msg) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPOUSE_MESSAGE.getValue());
        mplew.writeShort(11);
        mplew.writeMapleAsciiString(msg);
        return mplew.getPacket();
    }

    public static byte[] getNodeProperties(MapleMonster objectid, MapleMap map) {
        if (objectid.getNodePacket() != null) {
            return objectid.getNodePacket();
        }
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MONSTER_PROPERTIES.getValue());
        mplew.writeInt(objectid.getObjectId());
        mplew.writeInt(map.getNodes().size());
        mplew.writeInt(objectid.getPosition().x);
        mplew.writeInt(objectid.getPosition().y);
        for (MapleNodes.MapleNodeInfo mni : map.getNodes()) {
            mplew.writeInt(mni.x);
            mplew.writeInt(mni.y);
            mplew.writeInt(mni.attr);
            if (mni.attr == 2) {
                mplew.writeInt(500);
            }
        }
        mplew.writeZeroBytes(6);
        objectid.setNodePacket(mplew.getPacket());
        return objectid.getNodePacket();
    }

    public static byte[] getMovingPlatforms(MapleMap map) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MOVE_PLATFORM.getValue());
        mplew.writeInt(map.getPlatforms().size());
        for (MapleNodes.MaplePlatform mp : map.getPlatforms()) {
            mplew.writeMapleAsciiString(mp.name);
            mplew.writeInt(mp.start);
            mplew.writeInt(mp.SN.size());
            for (int x = 0; x < mp.SN.size(); x++) {
                mplew.writeInt(((Integer) mp.SN.get(x)).intValue());
            }
            mplew.writeInt(mp.speed);
            mplew.writeInt(mp.x1);
            mplew.writeInt(mp.x2);
            mplew.writeInt(mp.y1);
            mplew.writeInt(mp.y2);
            mplew.writeInt(mp.x1);
            mplew.writeInt(mp.y1);
            mplew.writeShort(mp.r);
        }
        return mplew.getPacket();
    }

    public static byte[] getUpdateEnvironment(MapleMap map) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.UPDATE_ENV.getValue());
        mplew.writeInt(map.getEnvironment().size());
        for (Map.Entry mp : map.getEnvironment().entrySet()) {
            mplew.writeMapleAsciiString((String) mp.getKey());
            mplew.writeInt(((Integer) mp.getValue()).intValue());
        }
        return mplew.getPacket();
    }

    public static byte[] sendEngagementRequest(String name, int cid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.ENGAGE_REQUEST.getValue());
        mplew.write(0);
        mplew.writeMapleAsciiString(name);
        mplew.writeInt(cid);
        return mplew.getPacket();
    }

    public static byte[] trembleEffect(int type, int delay) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.BOSS_ENV.getValue());
        mplew.write(1);
        mplew.write(type);
        mplew.writeInt(delay);
        return mplew.getPacket();
    }

    public static byte[] sendEngagement(byte msg, int item, MapleCharacter male, MapleCharacter female) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.ENGAGE_RESULT.getValue());
        mplew.write(msg);
        switch (msg) {
            case 11:
                mplew.writeInt(0);
                mplew.writeInt(male.getId());
                mplew.writeInt(female.getId());
                mplew.writeShort(1);
                mplew.writeInt(item);
                mplew.writeInt(item);
                mplew.writeAsciiString(male.getName(), 13);
                mplew.writeAsciiString(female.getName(), 13);
        }

        return mplew.getPacket();
    }

    public static byte[] updateJaguar(MapleCharacter from) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.UPDATE_JAGUAR.getValue());
        PacketHelper.addJaguarInfo(mplew, from);

        return mplew.getPacket();
    }

    public static byte[] teslaTriangle(int cid, int sum1, int sum2, int sum3) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.TESLA_TRIANGLE.getValue());
        mplew.writeInt(cid);
        mplew.writeInt(sum1);
        mplew.writeInt(sum2);
        mplew.writeInt(sum3);
        return mplew.getPacket();
    }

    public static byte[] mechPortal(Point pos) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MECH_PORTAL.getValue());
        mplew.writePos(pos);
        return mplew.getPacket();
    }

    public static byte[] spawnMechDoor(MechDoor md, boolean animated) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MECH_DOOR_SPAWN.getValue());
        mplew.write(animated ? 0 : 1);
        mplew.writeInt(md.getOwnerId());
        mplew.writePos(md.getTruePosition());
        mplew.write(md.getId());
        mplew.writeInt(md.getPartyId());
        return mplew.getPacket();
    }

    public static byte[] removeMechDoor(MechDoor md, boolean animated) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MECH_DOOR_REMOVE.getValue());
        mplew.write(animated ? 0 : 1);
        mplew.writeInt(md.getOwnerId());
        mplew.write(md.getId());
        return mplew.getPacket();
    }

    public static byte[] 使用SP重置(int cid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SP_RESET.getValue());
        mplew.write(1);
        mplew.writeInt(cid);
        mplew.write(1);

        return mplew.getPacket();
    }

    public static byte[] 使用AP重置(int cid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.AP_RESET.getValue());
        mplew.write(1);
        mplew.writeInt(cid);
        mplew.write(1);

        return mplew.getPacket();
    }

    public static byte[] playerDamaged(int cid, int dmg) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PLAYER_DAMAGED.getValue());
        mplew.writeInt(cid);
        mplew.writeInt(dmg);

        return mplew.getPacket();
    }

    public static byte[] pamsSongEffect(int cid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PAMS_SONG.getValue());
        mplew.writeInt(cid);

        return mplew.getPacket();
    }

    public static byte[] pamsSongUI() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PAMS_SONG.getValue());
        mplew.writeShort(0);

        return mplew.getPacket();
    }

    public static byte[] englishQuizMsg(String msg) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.ENGLISH_QUIZ.getValue());
        mplew.writeInt(20);
        mplew.writeMapleAsciiString(msg);

        return mplew.getPacket();
    }

    public static byte[] report(int err) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.REPORT.getValue());
        mplew.write(err);
        if ((GameConstants.GMS) && (err == 2)) {
            mplew.write(0);
            mplew.writeInt(1);
        }
        return mplew.getPacket();
    }

    public static byte[] sendLieDetector(byte[] image, int attempt) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.LIE_DETECTOR.getValue());
        mplew.write(7);
        mplew.write(3);
        mplew.write(1);
        mplew.write(attempt - 1);
        if (image == null) {
            mplew.writeInt(0);
            return mplew.getPacket();
        }
        mplew.writeInt(image.length);
        mplew.write(image);

        return mplew.getPacket();
    }

    public static byte[] LieDetectorResponse(byte msg) {
        return LieDetectorResponse(msg, (byte) 0);
    }

    public static byte[] LieDetectorResponse(byte msg, byte msg2) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.LIE_DETECTOR.getValue());

        mplew.write(msg);
        mplew.write(msg2);

        return mplew.getPacket();
    }

    public static byte[] enableReport() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(3);
        mplew.writeShort(SendPacketOpcode.ENABLE_REPORT.getValue());
        mplew.write(1);
        return mplew.getPacket();
    }

    public static byte[] reportResponse(byte mode, int remainingReports) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.REPORT_RESPONSE.getValue());
        mplew.writeShort(mode);
        if (mode == 2) {
            mplew.write(1);
            mplew.writeInt(remainingReports);
        }
        return mplew.getPacket();
    }

    public static byte[] ultimateExplorer() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.ULTIMATE_EXPLORER.getValue());

        return mplew.getPacket();
    }

    public static byte[] GMPoliceMessage() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GM_POLICE.getValue());
        mplew.writeInt(0);
        return mplew.getPacket();
    }

    public static byte[] pamSongUI() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PAM_SONG.getValue());

        return mplew.getPacket();
    }

    public static byte[] dragonBlink(int portalId) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.DRAGON_BLINK.getValue());
        mplew.write(portalId);
        return mplew.getPacket();
    }

    public static byte[] showTraitGain(MapleTrait.MapleTraitType trait, int amount) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(16);
        mplew.writeLong(trait.getStat().getValue());
        mplew.writeInt(amount);
        return mplew.getPacket();
    }

    public static byte[] showTraitMaxed(MapleTrait.MapleTraitType trait) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(GameConstants.GMS ? 17 : 19);
        if (GameConstants.GMS) {
            mplew.writeLong(trait.getStat().getValue());
        } else {
            mplew.writeInt((int) trait.getStat().getValue());
        }
        return mplew.getPacket();
    }

    public static byte[] harvestMessage(int oid, int msg) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.HARVEST_MESSAGE.getValue());
        mplew.writeInt(oid);
        mplew.writeInt(msg);
        return mplew.getPacket();
    }

    public static byte[] showHarvesting(int cid, int tool) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_HARVEST.getValue());
        mplew.writeInt(cid);
        if (tool > 0) {
            mplew.write(1);
            mplew.writeInt(tool);
        } else {
            mplew.write(0);
        }
        return mplew.getPacket();
    }

    public static byte[] harvestResult(int cid, boolean success) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.HARVESTED.getValue());
        mplew.writeInt(cid);
        mplew.write(success ? 1 : 0);
        mplew.writeInt(0);//115+
        return mplew.getPacket();
    }

    public static byte[] makeExtractor(int cid, String cname, Point pos, int timeLeft, int itemId, int fee) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPAWN_EXTRACTOR.getValue());
        mplew.writeInt(cid);
        mplew.writeMapleAsciiString(cname);
        mplew.writeInt(pos.x);
        mplew.writeInt(pos.y);
        mplew.writeShort(timeLeft);
        mplew.writeInt(itemId);
        mplew.writeInt(fee);
        return mplew.getPacket();
    }

    public static byte[] removeExtractor(int cid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.REMOVE_EXTRACTOR.getValue());
        mplew.writeInt(cid);
        mplew.writeInt(1);
        return mplew.getPacket();
    }

    public static byte[] spouseMessage(String msg, boolean white) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPOUSE_MESSAGE.getValue());

        mplew.writeShort(white ? 10 : 6);
        mplew.writeMapleAsciiString(msg);
        return mplew.getPacket();
    }

    public static byte[] spouseMessage(int op, String msg) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SPOUSE_MESSAGE.getValue());

        mplew.writeShort(op);
        mplew.writeMapleAsciiString(msg);
        return mplew.getPacket();
    }

    public static byte[] openBag(int index, int itemId, boolean firstTime) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.OPEN_BAG.getValue());
        mplew.writeInt(index);
        mplew.writeInt(itemId);
        mplew.writeShort(firstTime ? 1 : 0);
        return mplew.getPacket();
    }

    public static byte[] showOwnCraftingEffect(String effect, int time, int mode) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
        mplew.write(36);
        mplew.writeMapleAsciiString(effect);
        mplew.write(1);
        mplew.writeInt(time);
        mplew.writeInt(mode);

        return mplew.getPacket();
    }

    public static byte[] showCraftingEffect(int cid, String effect, int time, int mode) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_FOREIGN_EFFECT.getValue());
        mplew.writeInt(cid);
        mplew.write(36);
        mplew.writeMapleAsciiString(effect);
        mplew.write(1);
        mplew.writeInt(time);
        mplew.writeInt(mode);

        return mplew.getPacket();
    }

    public static byte[] craftMake(int cid, int something, int time) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CRAFT_EFFECT.getValue());
        mplew.writeInt(cid);
        mplew.writeInt(something);
        mplew.writeInt(time);
        return mplew.getPacket();
    }

    public static byte[] craftFinished(int cid, int craftID, int ranking, int itemId, int quantity, int exp) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CRAFT_COMPLETE.getValue());
        mplew.writeInt(cid);
        mplew.writeInt(craftID);
        mplew.writeInt(ranking);
        if (ranking != 23) {
            mplew.writeInt(itemId);
            mplew.writeInt(quantity);
        }
        mplew.writeInt(exp);
        return mplew.getPacket();
    }

    public static byte[] craftMessage(String msg) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.CRAFT_MESSAGE.getValue());
        mplew.writeMapleAsciiString(msg);
        mplew.write(1);
        return mplew.getPacket();
    }

    public static byte[] shopDiscount(int percent) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOP_DISCOUNT.getValue());
        mplew.write(percent);
        return mplew.getPacket();
    }

    public static byte[] changeCardSet(int set) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CARD_SET.getValue());
        mplew.writeInt(set);
        return mplew.getPacket();
    }

    public static byte[] getCard(int itemid, int level) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GET_CARD.getValue());
        mplew.write(itemid > 0 ? 1 : 0);
        if (itemid > 0) {
            mplew.writeInt(itemid);
            mplew.writeInt(level);
        }
        return mplew.getPacket();
    }

    public static byte[] upgradeBook(Item book, MapleCharacter chr) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.BOOK_STATS.getValue());
        mplew.writeInt(book.getPosition());
        PacketHelper.addItemInfo(mplew, book, true, true, false, false, chr);
        return mplew.getPacket();
    }

    public static byte[] pendantSlot(boolean p) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PENDANT_SLOT.getValue());
        mplew.write(p ? 1 : 0);
        return mplew.getPacket();
    }

    public static byte[] getMonsterBookInfo(MapleCharacter chr) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.BOOK_INFO.getValue());
        mplew.writeInt(chr.getId());
        mplew.writeInt(chr.getLevel());
        chr.getMonsterBook().writeCharInfoPacket(mplew);
        return mplew.getPacket();
    }

    public static byte[] getBuffBar(long millis) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.BUFF_BAR.getValue());
        mplew.writeLong(millis);
        return mplew.getPacket();
    }

    public static byte[] setNPCScriptable0(List<Pair<Integer, String>> npcs) {
        if (ServerProperties.ShowPacket()) {
            log.info("调用: " + new java.lang.Throwable().getStackTrace()[0]);
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.NPC_SCRIPTABLE.getValue());
        mplew.write(npcs.size());
        for (Pair s : npcs) {
            mplew.writeInt(((Integer) s.left).intValue());
            mplew.writeMapleAsciiString((String) s.right);
            mplew.writeInt(0);
            mplew.writeInt(2147483647);
        }
        return mplew.getPacket();
    }

    public static byte[] showMidMsg(String s, int l) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.MID_MSG.getValue());
        mplew.write(l);
        mplew.writeMapleAsciiString(s);
        mplew.write(s.length() > 0 ? 0 : 1);
        return mplew.getPacket();
    }

    public static byte[] showMemberSearch(List<MapleCharacter> chr) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.MEMBER_SEARCH.getValue());
        mplew.write(chr.size());
        for (MapleCharacter c : chr) {
            mplew.writeInt(c.getId());
            mplew.writeMapleAsciiString(c.getName());
            mplew.writeShort(c.getJob());
            mplew.write(c.getLevel());
        }
        return mplew.getPacket();
    }

    public static byte[] showPartySearch(List<MapleParty> chr) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.PARTY_SEARCH.getValue());
        mplew.write(chr.size());
        for (MapleParty c : chr) {
            mplew.writeInt(c.getId());
            mplew.writeMapleAsciiString(c.getLeader().getName());
            mplew.write(c.getLeader().getLevel());
            mplew.write(c.getLeader().isOnline() ? 1 : 0);
            mplew.write(c.getMembers().size());
            for (MaplePartyCharacter ch : c.getMembers()) {
                mplew.writeInt(ch.getId());
                mplew.writeMapleAsciiString(ch.getName());
                mplew.writeShort(ch.getJobId());
                mplew.write(ch.getLevel());
                mplew.write(ch.isOnline() ? 1 : 0);
            }
        }
        return mplew.getPacket();
    }

    public static byte[] showBackgroundEffect(String eff, int value) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.VISITOR.getValue());
        mplew.writeMapleAsciiString(eff);
        mplew.write(value);
        return mplew.getPacket();
    }

    public static byte[] updateGender(MapleCharacter chr) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.UPDATE_GENDER.getValue());
        mplew.write(chr.getGender());
        return mplew.getPacket();
    }

    public static byte[] registerFamiliar(MonsterFamiliar mf) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.REGISTER_FAMILIAR.getValue());
        mplew.writeLong(mf.getId());
        mf.writeRegisterPacket(mplew, false);
        mplew.writeShort(mf.getVitality() >= 3 ? 1 : 0);

        return mplew.getPacket();
    }

    public static byte[] touchFamiliar(int cid, byte unk, int objectid, int type, int delay, int damage) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.TOUCH_FAMILIAR.getValue());
        mplew.writeInt(cid);
        mplew.write(0);
        mplew.write(unk);
        mplew.writeInt(objectid);
        mplew.writeInt(type);
        mplew.writeInt(delay);
        mplew.writeInt(damage);
        return mplew.getPacket();
    }

    public static byte[] familiarAttack(int cid, byte unk, List<Triple<Integer, Integer, List<Integer>>> attackPair) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.ATTACK_FAMILIAR.getValue());
        mplew.writeInt(cid);
        mplew.write(0);
        mplew.write(unk);
        mplew.write(attackPair.size());
        for (Triple s : attackPair) {
            mplew.writeInt(((Integer) s.left).intValue());
            mplew.write(((Integer) s.mid).intValue());
            mplew.write(((List) s.right).size());
            for (Iterator i = ((List) s.right).iterator(); i.hasNext();) {
                int damage = ((Integer) i.next()).intValue();
                mplew.writeInt(damage);
            }
        }
        Iterator i;
        return mplew.getPacket();
    }

    public static byte[] updateFamiliar(MonsterFamiliar mf) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.UPDATE_FAMILIAR.getValue());
        mplew.writeInt(mf.getCharacterId());
        mplew.writeInt(mf.getFamiliar());
        mplew.writeInt(mf.getFatigue());
        mplew.writeLong(PacketHelper.getTime(mf.getVitality() >= 3 ? System.currentTimeMillis() : -2L));
        return mplew.getPacket();
    }

    public static byte[] removeFamiliar(int cid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.SPAWN_FAMILIAR.getValue());
        mplew.writeInt(cid);
        mplew.writeShort(0);
        mplew.write(0);
        return mplew.getPacket();
    }

    public static byte[] spawnFamiliar(MonsterFamiliar mf, boolean spawn) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.SPAWN_FAMILIAR.getValue());
        mplew.writeInt(mf.getCharacterId());
        mplew.writeShort(spawn ? 1 : 0);
        mplew.write(0);
        if (spawn) {
            mplew.writeInt(mf.getFamiliar());
            mplew.writeInt(mf.getFatigue());
            mplew.writeInt(mf.getVitality() * 300);
            mplew.writeMapleAsciiString(mf.getName());
            mplew.writePos(mf.getTruePosition());
            mplew.write(mf.getStance());
            mplew.writeShort(mf.getFh());
        }
        return mplew.getPacket();
    }

    public static byte[] moveFamiliar(int cid, Point startPos, List<LifeMovementFragment> moves) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MOVE_FAMILIAR.getValue());
        mplew.writeInt(cid);
        mplew.write(0);
        mplew.writePos(startPos);
        mplew.writeInt(0);

        PacketHelper.serializeMovementList(mplew, moves);

        return mplew.getPacket();
    }

    public static byte[] achievementRatio(int amount) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.ACHIEVEMENT_RATIO.getValue());
        mplew.writeInt(amount);

        return mplew.getPacket();
    }

    public static byte[] createUltimate(int amount) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CREATE_ULTIMATE.getValue());
        mplew.writeInt(amount);

        return mplew.getPacket();
    }

    public static byte[] professionInfo(String skil, int level1, int level2, int chance) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PROFESSION_INFO.getValue());
        mplew.writeMapleAsciiString(skil);
        mplew.writeInt(level1);
        mplew.writeInt(level2);
        mplew.write(1);
        mplew.writeInt((skil.startsWith("9200")) || (skil.startsWith("9201")) ? 100 : chance);
        
        
        return mplew.getPacket();
    }

    public static byte[] quickSlot(String skil) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.QUICK_SLOT.getValue());
        mplew.write(skil == null ? 0 : 1);
        if (skil != null) {
            for (int i = 0; i < skil.length(); i++) {
                mplew.writeAsciiString(skil.substring(i, i + 1));
                mplew.writeZeroBytes(3);
            }
        }

        return mplew.getPacket();
    }

    public static byte[] getFamiliarInfo(MapleCharacter chr) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.FAMILIAR_INFO.getValue());
        mplew.writeInt(chr.getFamiliars().size());
        for (MonsterFamiliar mf : chr.getFamiliars().values()) {
            mf.writeRegisterPacket(mplew, true);
        }
        List<Pair<Integer, Long>> size = new ArrayList();
        for (Item i : chr.getInventory(MapleInventoryType.USE).list()) {
            if (i.getItemId() / 10000 == 287) {
                StructFamiliar f = MapleItemInformationProvider.getInstance().getFamiliarByItem(i.getItemId());
                if (f != null) {
                    size.add(new Pair(Integer.valueOf(f.familiar), Long.valueOf(i.getInventoryId())));
                }
            }
        }
        mplew.writeInt(size.size());
        for (Pair<Integer, Long> s : size) {
            mplew.writeInt(chr.getId());
            mplew.writeInt(((Integer) s.left).intValue());
            mplew.writeLong(((Long) s.right).longValue());
            mplew.write(0);
        }
        size.clear();
        return mplew.getPacket();
    }

    public static byte[] 更新道具宝宝(MapleImp imp, int mask, int index, boolean login) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.ITEM_POT.getValue());
        mplew.write(login ? 0 : 1);
        mplew.writeInt(index + 1);
        mplew.writeInt(mask);
        if ((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) {
            Pair i = MapleItemInformationProvider.getInstance().getPot(imp.getItemId());
            if (i == null) {
                return enableActions();
            }
            mplew.writeInt(((Integer) i.left).intValue());
            mplew.write(imp.getLevel());
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.STATE.getValue()) != 0)) {
            mplew.write(imp.getState());
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.FULLNESS.getValue()) != 0)) {
            mplew.writeInt(imp.getFullness());
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.CLOSENESS.getValue()) != 0)) {
            mplew.writeInt(imp.getCloseness());
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.CLOSENESS_LEFT.getValue()) != 0)) {
            mplew.writeInt(1);
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.MINUTES_LEFT.getValue()) != 0)) {
            mplew.writeInt(0);
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.LEVEL.getValue()) != 0)) {
            mplew.write(1);
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.FULLNESS_2.getValue()) != 0)) {
            mplew.writeInt(imp.getFullness());
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.UPDATE_TIME.getValue()) != 0)) {
            mplew.writeLong(PacketHelper.getTime(System.currentTimeMillis()));
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.CREATE_TIME.getValue()) != 0)) {
            mplew.writeLong(PacketHelper.getTime(System.currentTimeMillis()));
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.AWAKE_TIME.getValue()) != 0)) {
            mplew.writeLong(PacketHelper.getTime(System.currentTimeMillis()));
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.SLEEP_TIME.getValue()) != 0)) {
            mplew.writeLong(PacketHelper.getTime(System.currentTimeMillis()));
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.MAX_CLOSENESS.getValue()) != 0)) {
            mplew.writeInt(100);
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.MAX_DELAY.getValue()) != 0)) {
            mplew.writeInt(1000);
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.MAX_FULLNESS.getValue()) != 0)) {
            mplew.writeInt(1000);
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.MAX_ALIVE.getValue()) != 0)) {
            mplew.writeInt(1);
        }
        if (((mask & MapleImp.ImpFlag.SUMMONED.getValue()) != 0) || ((mask & MapleImp.ImpFlag.MAX_MINUTES.getValue()) != 0)) {
            mplew.writeInt(10);
        }
        mplew.write(0);
        return mplew.getPacket();
    }

    public static byte[] spawnFlags(List<Pair<String, Integer>> flags) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.LOGIN_WELCOME.getValue());
        mplew.write(flags == null ? 0 : flags.size());
        if (flags != null) {
            for (Pair f : flags) {
                mplew.writeMapleAsciiString((String) f.left);
                mplew.write(((Integer) f.right).intValue());
            }
        }

        return mplew.getPacket();
    }

    public static byte[] getPVPScoreboard(List<Pair<Integer, MapleCharacter>> flags, int type) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_SCOREBOARD.getValue());
        mplew.writeShort(flags.size());
        for (Pair f : flags) {
            mplew.writeInt(((MapleCharacter) f.right).getId());
            mplew.writeMapleAsciiString(((MapleCharacter) f.right).getName());
            mplew.writeInt(((Integer) f.left).intValue());
            mplew.write(type == 0 ? 0 : ((MapleCharacter) f.right).getTeam() + 1);
        }

        return mplew.getPacket();
    }

    public static byte[] getPVPResult(List<Pair<Integer, MapleCharacter>> flags, int exp, int winningTeam, int playerTeam) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_RESULT.getValue());
        mplew.writeInt(flags.size());
        for (Pair f : flags) {
            mplew.writeInt(((MapleCharacter) f.right).getId());
            mplew.writeMapleAsciiString(((MapleCharacter) f.right).getName());
            mplew.writeInt(((Integer) f.left).intValue());
            mplew.writeShort(((MapleCharacter) f.right).getTeam() + 1);
            if (GameConstants.GMS) {
                mplew.writeInt(0);
            }
        }
        mplew.writeZeroBytes(24);
        mplew.writeInt(exp);
        mplew.write(0);
        if (GameConstants.GMS) {
            mplew.writeShort(100);
            mplew.writeInt(0);
        }
        mplew.write(winningTeam);
        mplew.write(playerTeam);

        return mplew.getPacket();
    }

    public static byte[] showStatusMessage(String info, String data) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(22);
        mplew.writeMapleAsciiString(info);
        mplew.writeMapleAsciiString(data);

        return mplew.getPacket();
    }

    public static byte[] showOwnChampionEffect() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
        mplew.write(32);
        mplew.writeInt(30000);

        return mplew.getPacket();
    }

    public static byte[] showChampionEffect(int from_playerid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_FOREIGN_EFFECT.getValue());
        mplew.writeInt(from_playerid);
        mplew.write(32);
        mplew.writeInt(30000);

        return mplew.getPacket();
    }

    public static byte[] PVP启用(boolean enabled) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_ENABLED.getValue());
        mplew.write(enabled ? 1 : 2);

        return mplew.getPacket();
    }

    public static byte[] PVP获取模式(int mode) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_MODE.getValue());
        mplew.write(mode);

        return mplew.getPacket();
    }

    public static byte[] PVP获取类型(int type, List<Pair<Integer, String>> players1, int team, boolean enabled, int lvl) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_TYPE.getValue());
        mplew.write(type);
        mplew.write(lvl);
        mplew.write(enabled ? 1 : 0);
        if (type > 0) {
            mplew.write(team);
            mplew.writeInt(players1.size());
            for (Pair pl : players1) {
                mplew.writeInt(((Integer) pl.left).intValue());
                mplew.writeMapleAsciiString((String) pl.right);
                mplew.writeShort(2660);
            }
        }

        return mplew.getPacket();
    }

    public static byte[] PVP获取组队(List<Pair<Integer, String>> players) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_TEAM.getValue());
        mplew.writeInt(players.size());
        for (Pair pl : players) {
            mplew.writeInt(((Integer) pl.left).intValue());
            mplew.writeMapleAsciiString((String) pl.right);
            mplew.writeShort(2660);
        }

        return mplew.getPacket();
    }

    public static byte[] PVP获取分数(int score, boolean kill) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_SCORE.getValue());
        mplew.writeInt(score);
        mplew.write(kill ? 1 : 0);

        return mplew.getPacket();
    }

    public static byte[] PVP获取冰骑士(int score) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_ICEGAGE.getValue());
        mplew.writeInt(score);

        return mplew.getPacket();
    }

    public static byte[] PVP获取Killed(String lastWords) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_KILLED.getValue());
        mplew.writeMapleAsciiString(lastWords);

        return mplew.getPacket();
    }

    public static byte[] PVPgetPoints(int p1, int p2) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_POINTS.getValue());

        mplew.writeInt(p1);
        mplew.writeInt(p2);

        return mplew.getPacket();
    }

    public static byte[] PVPgetHPBar(int cid, int hp, int maxHp) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_HP.getValue());

        mplew.writeInt(cid);
        mplew.writeInt(hp);
        mplew.writeInt(maxHp);

        return mplew.getPacket();
    }

    public static byte[] PVPgetIceHPBar(int hp, int maxHp) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_ICEKNIGHT.getValue());

        mplew.writeInt(hp);
        mplew.writeInt(maxHp);

        return mplew.getPacket();
    }

    public static byte[] PVPgetMist(int cid, int mistSkill, int mistLevel, int damage) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_MIST.getValue());

        mplew.writeInt(cid);
        mplew.writeInt(mistSkill);
        mplew.write(mistLevel);
        mplew.writeInt(damage);
        mplew.write(8);
        mplew.writeInt(1000);

        return mplew.getPacket();
    }

    public static byte[] getCaptureFlags(MapleMap map) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CAPTURE_FLAGS.getValue());
        mplew.writeRect(map.getArea(0));
        mplew.writeInt(((Point) ((Pair) map.getGuardians().get(0)).left).x);
        mplew.writeInt(((Point) ((Pair) map.getGuardians().get(0)).left).y);
        mplew.writeRect(map.getArea(1));
        mplew.writeInt(((Point) ((Pair) map.getGuardians().get(1)).left).x);
        mplew.writeInt(((Point) ((Pair) map.getGuardians().get(1)).left).y);
        return mplew.getPacket();
    }

    public static byte[] getCapturePosition(MapleMap map) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        Point p1 = map.getPointOfItem(2910000);
        Point p2 = map.getPointOfItem(2910001);
        mplew.writeShort(SendPacketOpcode.CAPTURE_POSITION.getValue());
        mplew.write(p1 == null ? 0 : 1);
        if (p1 != null) {
            mplew.writeInt(p1.x);
            mplew.writeInt(p1.y);
        }
        mplew.write(p2 == null ? 0 : 1);
        if (p2 != null) {
            mplew.writeInt(p2.x);
            mplew.writeInt(p2.y);
        }

        return mplew.getPacket();
    }

    public static byte[] resetCapture() {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CAPTURE_RESET.getValue());

        return mplew.getPacket();
    }

    public static byte[] pvpAttack(int cid, int playerLevel, int skill, int skillLevel, int speed, int mastery, int projectile, int attackCount, int chargeTime, int stance, int direction, int range, int linkSkill, int linkSkillLevel, boolean movementSkill, boolean pushTarget, boolean pullTarget, List<AttackPair> attack) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_ATTACK.getValue());
        mplew.writeInt(cid);
        mplew.write(playerLevel);
        mplew.writeInt(skill);
        mplew.write(skillLevel);
        mplew.writeInt(linkSkill != skill ? linkSkill : 0);
        mplew.write(linkSkillLevel != skillLevel ? linkSkillLevel : 0);
        mplew.write(direction);
        mplew.write(movementSkill ? 1 : 0);
        mplew.write(pushTarget ? 1 : 0);
        mplew.write(pullTarget ? 1 : 0);
        mplew.write(0);
        mplew.writeShort(stance);
        mplew.write(speed);
        mplew.write(mastery);
        mplew.writeInt(projectile);
        mplew.writeInt(chargeTime);
        mplew.writeInt(range);
        mplew.writeShort(attack.size());
        if (GameConstants.GMS) {
            mplew.writeInt(0);
        }
        mplew.write(attackCount);
        mplew.write(0);
        for (AttackPair p : attack) {
            mplew.writeInt(p.objectid);
            if (GameConstants.GMS) {
                mplew.writeInt(0);
            }
            mplew.writePos(p.point);
            mplew.writeZeroBytes(5);
            for (Pair atk : p.attack) {
                mplew.writeInt(((Integer) atk.left).intValue());
                if (GameConstants.GMS) {
                    mplew.writeInt(0);
                }
                mplew.write(((Boolean) atk.right).booleanValue() ? 1 : 0);
                mplew.writeShort(0);
            }
        }

        return mplew.getPacket();
    }

    public static byte[] pvpSummonAttack(int cid, int playerLevel, int oid, int animation, Point pos, List<AttackPair> attack) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_SUMMON.getValue());
        mplew.writeInt(cid);
        mplew.writeInt(oid);
        mplew.write(playerLevel);
        mplew.write(animation);
        mplew.writePos(pos);
        mplew.writeInt(0);
        mplew.write(attack.size());
        for (AttackPair p : attack) {
            mplew.writeInt(p.objectid);
            mplew.writePos(p.point);
            mplew.writeShort(p.attack.size());
            for (Pair atk : p.attack) {
                mplew.writeInt(((Integer) atk.left).intValue());
            }
        }

        return mplew.getPacket();
    }

    public static byte[] pvpCool(int cid, List<Integer> attack) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_COOL.getValue());
        mplew.writeInt(cid);
        mplew.write(attack.size());
        for (Iterator i$ = attack.iterator(); i$.hasNext();) {
            int b = ((Integer) i$.next()).intValue();
            mplew.writeInt(b);
        }
        return mplew.getPacket();
    }

    public static byte[] PVPgetClock(int type, int time) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CLOCK.getValue());
        mplew.write(3);
        mplew.write(type);
        mplew.writeInt(time);

        return mplew.getPacket();
    }

    public static byte[] PVPgetTransform(int type) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PVP_TRANSFORM.getValue());
        mplew.write(type);

        return mplew.getPacket();
    }

    public static byte[] changeTeam(int cid, int type) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.LOAD_TEAM.getValue());
        mplew.writeInt(cid);
        mplew.write(type);

        return mplew.getPacket();
    }

    public static byte[] 获取快速移动(MapleCharacter chr) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.QUICK_MOVE.getValue());
        if (!MapleQuickMove.isQuickMoveMap(chr.getMapId())) {
            mplew.write(0);
            return mplew.getPacket();
        }
        MapleQuickMove[] maps = MapleQuickMove.values();
        mplew.write(maps.length);
        for (MapleQuickMove map : maps) {
            mplew.writeMapleAsciiString(map.name);
            mplew.writeInt(map.npcid);
            mplew.writeInt(map.type);
            mplew.writeInt(map.level);
            mplew.writeMapleAsciiString(map.desc);
        }

        return mplew.getPacket();
    }

    public static byte[] 显示快速移动(MapleCharacter chr) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        
        mplew.writeShort(SendPacketOpcode.QUICK_MOVE.getValue());
        List<MapleQuickMove> QuickMove = MapleQuickMove.showQuickMove(chr.getMapId());
        mplew.write(QuickMove.size());
        mplew.writeShort(0);
        byte 检测 = 1;
        for (MapleQuickMove map : QuickMove) {
            mplew.writeMapleAsciiString(map.name);
            mplew.writeInt(map.npcid);
            mplew.writeInt(map.type);
            mplew.writeInt(map.level);
            mplew.writeMapleAsciiString(map.desc);

            mplew.writeLong(PacketHelper.getTime(-2L));
            mplew.writeLong(PacketHelper.getTime(-1L));
            mplew.writeShort(检测);
            检测 = (byte) (检测 + 1);
        }
        return mplew.getPacket();
    }

    public static byte[] showForce(int playerid, int oid, int forceCount, int forceColor) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GAIN_FORCE.getValue());
        mplew.write(1);
        mplew.writeInt(playerid);
        mplew.writeInt(oid);
        mplew.writeInt(0);
        mplew.write(1);
        mplew.writeInt(forceCount);
        mplew.writeInt(forceColor);
        mplew.writeInt(40);
        mplew.writeInt(5);
        mplew.writeInt(67);
        mplew.writeZeroBytes(12);
        mplew.writeShort(9433);
        mplew.writeShort(31116);
        mplew.writeZeroBytes(5);

        return mplew.getPacket();
    }

    public static byte[] 神之子_模式切换(int 性别, int HP, int TF, int MAXHP, int MAXTF) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.ZERO_CHANGE.getValue());
        mplew.writeShort(199);
        mplew.write((byte) 性别);
        mplew.writeInt(HP);
        mplew.writeInt(TF);
        mplew.writeInt(MAXHP);
        mplew.writeInt(MAXTF);

        return mplew.getPacket();
    }

    public static byte[] 刷新_神之子_背包_WP点数(int wp) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.ZERO_WP_UP.getValue());
        mplew.writeInt(wp);

        return mplew.getPacket();
    }

    public static byte[] 显示_神之子_获得_WP点数(int wp) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(32);
        mplew.writeInt(wp);

        return mplew.getPacket();
    }

    public static byte[] 神之子时间WP球显示(Point pos1, Point pos2, int playerid, int oid, int forceCount) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GAIN_FORCE.getValue());
        mplew.write(1);
        mplew.writeInt(playerid);
        mplew.writeInt(oid);
        mplew.writeInt(9);
        mplew.write(1);
        mplew.writeInt(forceCount);
        mplew.writeInt(36);
        mplew.writeInt(38);
        mplew.writeInt(5);
        mplew.writeInt(47);
        mplew.writeZeroBytes(13);
        mplew.writeInt(pos1.x);
        mplew.writeInt(pos1.y);
        mplew.writeInt(pos2.x);
        mplew.write((byte) pos2.y);
        mplew.write(1);
        mplew.writeZeroBytes(3);

        return mplew.getPacket();
    }

    public static byte[] 显示_神之子_武器升级_属性(int 类型, int 需要等级, int wp2, int wp1, boolean 是否需要封印的时间之石) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.ZERO_WP.getValue());
        mplew.write(0);
        mplew.writeInt(类型);
        mplew.write(0);
        mplew.writeInt(类型);
        mplew.writeInt(wp1);
        mplew.writeInt(wp2);
        mplew.write(是否需要封印的时间之石 ? 1 : 0);

        return mplew.getPacket();
    }

    public static byte[] 显示_神之子_武器_砸卷(int 行数, int 列数) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.ZERO_ZJ.getValue());
        mplew.writeShort(行数);
        mplew.write(0);
        mplew.writeInt(列数);
        return mplew.getPacket();
    }

    public static byte[] showCarte(int carte) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_CARTE.getValue());
        mplew.write(carte);

        return mplew.getPacket();
    }

    public static byte[] showCarte(MapleCharacter chr, int oid, int skillId, int forceCount) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GAIN_FORCE.getValue());
        mplew.write(0);
        mplew.writeInt(chr.getId());
        mplew.writeInt(1);
        mplew.write(1);
        mplew.writeInt(oid);
        mplew.writeInt(skillId);
        mplew.write(1);
        mplew.writeInt(forceCount);
        mplew.writeInt(2);
        mplew.writeInt(19);
        mplew.writeInt(11);
        mplew.writeInt(6);
        mplew.writeZeroBytes(12);
        mplew.writeInt(2146565436);
        mplew.writeZeroBytes(5);
        

        return mplew.getPacket();
    }

    

    public static byte[] 萝莉精髓(int chrId, int skillId, List<Integer> 打怪ID列表) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.GAIN_FORCE.getValue());
        mplew.write(0);
        mplew.writeInt(chrId);
        mplew.writeInt(3);
        mplew.write(0);
        mplew.writeInt(打怪ID列表.size());
        for (int i = 0; i < 打怪ID列表.size(); i++) {
            mplew.writeInt(((Integer) 打怪ID列表.get(i)).intValue());
        }
        mplew.writeInt(skillId);
        for (int i = 2; i <= 打怪ID列表.size(); i++) {
            mplew.write(1);
            mplew.writeInt(Randomizer.nextInt(255));
            mplew.writeInt(1);
            mplew.writeInt(Randomizer.nextInt(255));
            mplew.writeInt(Randomizer.nextInt(255));
            mplew.writeInt(Randomizer.nextInt(255));
            mplew.writeInt(Randomizer.nextInt(30000));
            mplew.writeShort(0);
        }
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] 风灵狂风肆虐(MapleCharacter chr, int oid, int skillId) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.GAIN_FORCE.getValue());
        mplew.write(0);
        mplew.writeInt(chr.getId());
        mplew.writeInt(7);
        mplew.write(1);
        mplew.writeInt(1);
        mplew.writeInt(oid);
        mplew.writeInt(skillId);
        mplew.write(1);
        mplew.writeInt((skillId == 13120010) || (skillId == 13110027) || (skillId == 13100027) ? 2 : 4);
        mplew.writeInt((skillId == 13120010) || (skillId == 13110027) || (skillId == 13100027) ? 2 : 1);
        mplew.writeInt((skillId == 13120010) || (skillId == 13110027) || (skillId == 13100027) ? 45 : 44);
        mplew.writeInt((skillId == 13120010) || (skillId == 13110027) || (skillId == 13100027) ? 7 : 5);
        mplew.writeInt((skillId == 13120010) || (skillId == 13110027) || (skillId == 13100027) ? 174 : 8);
        mplew.writeInt((skillId == 13120010) || (skillId == 13110027) || (skillId == 13100027) ? 38 : 40);
        mplew.writeZeroBytes(9);

        return mplew.getPacket();
    }

    public static byte[] showQuestMessage(String msg) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(11);
        mplew.writeMapleAsciiString(msg);

        return mplew.getPacket();
    }

    public static byte[] 发送登陆成功() {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.LOGIN_SUCC.getValue());

        return mplew.getPacket();
    }

    /**
     *打开背包掉线是这里包头有问题
     * @param chr
     * @return
     */
    public static byte[] 显示背包抵用券(MapleCharacter chr) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CHAR_CASH.getValue());
        mplew.writeInt(chr.getId());
        mplew.writeInt(chr.getCSPoints(2));

        return mplew.getPacket();
    }

    public static byte[] UNK() {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(182);
        mplew.writeInt(0);
        return mplew.getPacket();
    }

    public static byte[] UNK1() {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(211);
        mplew.write(0);
        return mplew.getPacket();
    }

    public static byte[] GainEXP_Monster(String testmsg) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
        mplew.write(3);
        mplew.write(1);
        mplew.writeInt(1000);
        mplew.write(0);

        mplew.writeInt(0);
        mplew.writeShort(0);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.write(0);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(0);

        return mplew.getPacket();
    }

    public static byte[] teachMessage(int skillId, int toChrId, String toChrName) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.TEACH_MESSAGE.getValue());
        mplew.writeInt(0);
        mplew.writeInt(skillId);
        mplew.writeInt(toChrId);
        mplew.writeMapleAsciiString(toChrName);

        return mplew.getPacket();
    }

    public static byte[] 显示武陵排名() {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.DOJANG_RANK.getValue());
        mplew.writeInt(1);
        mplew.writeShort(1);
        mplew.writeMapleAsciiString("六月君");
        mplew.writeLong(998L);

        return mplew.getPacket();
    }

    public static byte[] openWeb(String web) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.OPEN_WEB.getValue());
        mplew.writeMapleAsciiString(web);

        return mplew.getPacket();
    }

    public static byte[] sendPolice(String text) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MAPLE_ADMIN.getValue());
        mplew.writeMapleAsciiString(text);

        return mplew.getPacket();
    }

    public static byte[] 每日免费时空_显示(int mf, int cs) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.DAY_OF_SHIKONG.getValue());
        mplew.writeInt(30 - mf);
        mplew.writeInt(cs);
        return mplew.getPacket();
    }

    public static byte[] 每日免费时空_错误() {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.DAY_OF_SHIKONG1.getValue());
        mplew.write(0);
        return mplew.getPacket();
    }

    public static byte[] 刷新内在能力(int 位置, int skillid, int 值1, int 内在技能等级) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.UPDATE_NZ.getValue());
        mplew.write(位置 == 3 ? 1 : 0);
        mplew.write(1);
        mplew.writeShort(位置);
        mplew.writeInt(skillid);
        mplew.writeShort(值1);
        mplew.writeShort(内在技能等级);
        mplew.write(位置 == 3 ? 1 : 0);

        return mplew.getPacket();
    }

    public static byte[] 刷新荣誉等级和声望(int 荣誉等级, int 声望, boolean 是否快要提升) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.UPDATE_SW_RY.getValue());
        mplew.writeInt(荣誉等级);
        mplew.writeInt(声望);
        mplew.write(是否快要提升 ? 1 : 0);

        return mplew.getPacket();
    }

    

    public static byte[] 刷新狂龙能量(int 能量) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        mplew.writeZeroBytes(17);
        mplew.write(128);
        mplew.writeZeroBytes(30);
        mplew.writeInt(能量);
        mplew.writeShort(0);
        mplew.writeInt(-207404);
        mplew.writeZeroBytes(22);

        return mplew.getPacket();
    }

    public static byte[] 刷新恶魔复仇者攻击力(int hp) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        
        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        mplew.writeZeroBytes(28);
        mplew.write(8);
        mplew.writeZeroBytes(23);
        mplew.write(3);
        mplew.writeInt(0);
        mplew.writeShort(0);
        mplew.writeInt(8203125);
        mplew.writeInt(0);
        mplew.writeInt(hp);
        mplew.writeZeroBytes(13);

        return mplew.getPacket();
    }

    public static byte[] 恶魔复仇者_超越系列(int skill, int skilllevel) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        
        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        mplew.writeZeroBytes(15);
        mplew.write(64);
        mplew.writeZeroBytes(32);
        mplew.writeShort(skilllevel);
        mplew.writeInt(skill);
        mplew.writeInt(575343569);
        mplew.writeZeroBytes(18);

        return mplew.getPacket();
    }

    public static byte[] 冒险家自由转职窗口() {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.MXJ_ZYZZ_CK.getValue());
        mplew.writeInt(167);

        return mplew.getPacket();
    }

    public static byte[] 萝莉变身器使用反馈(int 装备类型) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.LUOLI_BSQ.getValue());
        mplew.writeInt(21173);
        mplew.writeInt(37141);
        mplew.writeInt(装备类型);
        mplew.write(0);

        return mplew.getPacket();
    }

    public static byte[] showOwnJobChangedElf(String effect, int time, int itemId) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
        mplew.write(36);
        mplew.writeMapleAsciiString(effect);
        mplew.write(1);
        mplew.writeInt(0);
        mplew.writeInt(time);
        mplew.writeInt(itemId);

        return mplew.getPacket();
    }

    public static byte[] showJobChangedElf(int cid, String effect, int time, int mode) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_FOREIGN_EFFECT.getValue());
        mplew.writeInt(cid);
        mplew.write(36);
        mplew.writeMapleAsciiString(effect);
        mplew.write(1);
        mplew.writeInt(0);
        mplew.writeInt(time);
        mplew.writeInt(mode);

        return mplew.getPacket();
    }

    public static byte[] 萝莉重生技能(int skillid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.LUOLI_CS.getValue());
        mplew.writeInt(skillid);

        return mplew.getPacket();
    }

    public static byte[] testPacket(String testmsg) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.write(HexTool.getByteArrayFromHexString(testmsg));
        return mplew.getPacket();
    }

    public static byte[] testPacket(byte[] testmsg) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.write(testmsg);
        return mplew.getPacket();
    }

    public static byte[] testPacket(String op, String text) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.write(HexTool.getByteArrayFromHexString(op));
        mplew.writeMapleAsciiString(text);
        return mplew.getPacket();
    }

    public static byte[] sendphantomunequip(int skillid) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PHANTOM_EQUIP_SEND.getValue());
        mplew.write(HexTool.getByteArrayFromHexString("01 00"));
        mplew.writeInt(skillid);
        return mplew.getPacket();
    }

    public static byte[] sendphantomequip(int chrid, int skillid) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PHANTOM_EQUIP_SEND.getValue());
        mplew.write(HexTool.getByteArrayFromHexString("01 01"));
        mplew.writeInt(chrid);
        mplew.writeInt(skillid);
        return mplew.getPacket();
    }

    public static byte[] sendphantomview(int skillid, int skilllvl, int type, int xtype) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PHANTOM_VIEW_SEND.getValue());
        mplew.writeShort(1);
        mplew.writeInt(type);
        mplew.writeInt(xtype);
        mplew.writeInt(skillid);
        mplew.writeInt(skilllvl);
        mplew.writeInt(0);
        return mplew.getPacket();
    }

    public static byte[] sendphantomdrop(int chrid, int type, int xtype) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PHANTOM_VIEW_SEND.getValue());
        mplew.write(HexTool.getByteArrayFromHexString("01 03"));
        mplew.writeShort(1);
        mplew.writeInt(type);
        mplew.writeInt(xtype);
        return mplew.getPacket();
    }

    public static byte[] sendphantomskill(int chrid, int jobid, List<Integer> skills) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PHANTOM_SKILL_SEND.getValue());
        mplew.write(1);
        mplew.writeInt(chrid);
        mplew.writeInt(4);
        mplew.writeInt(jobid);
        mplew.writeInt(skills.size());
        for (Iterator i$ = skills.iterator(); i$.hasNext();) {
            int b = ((Integer) i$.next()).intValue();
            mplew.writeInt(b);
        }
        return mplew.getPacket();
    }

    static {
        DEFAULT_BUFFMASK |= MapleBuffStat.能量获得.getValue();
        DEFAULT_BUFFMASK |= MapleBuffStat.疾驰速度.getValue();
        DEFAULT_BUFFMASK |= MapleBuffStat.疾驰跳跃.getValue();
        DEFAULT_BUFFMASK |= MapleBuffStat.骑兽技能.getValue();
        DEFAULT_BUFFMASK |= MapleBuffStat.极速领域.getValue();
        DEFAULT_BUFFMASK |= MapleBuffStat.导航辅助.getValue();
        DEFAULT_BUFFMASK |= MapleBuffStat.DEFAULT_BUFFSTAT.getValue();
    }

    public static byte[] 品克缤敲敲_窗口(int itemid, boolean 是否进入下一阶段) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PKB_QQ_T.getValue());
        mplew.writeInt(5);
        mplew.write(是否进入下一阶段 ? 1 : 0);
        mplew.writeInt(36);
        mplew.writeInt(itemid);
        mplew.write(0);
        mplew.writeInt(700);
        mplew.writeInt(5);
        mplew.writeInt(4);

        mplew.writeInt(5224008);
        mplew.writeInt(50400366);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(2550);
        mplew.writeInt(3);

        mplew.writeInt(5224006);
        mplew.writeInt(50400364);
        mplew.writeInt(5224007);
        mplew.writeInt(50400365);
        mplew.writeInt(0);
        mplew.writeInt(1550);
        mplew.writeInt(2);

        mplew.writeInt(5224011);
        mplew.writeInt(50400456);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(100);
        mplew.writeInt(1200);
        mplew.writeInt(1);

        mplew.writeInt(5224009);
        mplew.writeInt(50400454);
        mplew.writeInt(5224010);
        mplew.writeInt(50400455);
        mplew.writeInt(100);
        mplew.writeInt(700);
        mplew.writeInt(0);

        mplew.writeInt(5224000);
        mplew.writeInt(50400358);
        mplew.writeInt(5224001);
        mplew.writeInt(50400359);

        mplew.writeInt(100);
        mplew.writeInt(350);

        return mplew.getPacket();
    }

    public static byte[] 品克缤_敲敲_完成(boolean 是否成功, int itemid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PKB_QQ_F.getValue());
        if (是否成功) {
            mplew.write(1);
            mplew.writeInt(itemid);
            mplew.writeInt(itemid + 1 > 5224010 ? itemid + 1 : 5224000);
            mplew.writeInt(36);
            mplew.writeInt(5);
            mplew.writeInt(700);
        } else {
            mplew.write(4);
        }
        return mplew.getPacket();
    }

    public static byte[] 品克缤_敲敲_获得物品(int itemid) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.PKB_QQ_TS.getValue());
        mplew.writeInt(itemid);

        return mplew.getPacket();
    }

    public static byte[] 品克缤_敲敲_显示获得物品_1(String effect, int itemId) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
        mplew.write(1);
        mplew.writeInt(itemId);
        mplew.writeMapleAsciiString(effect);

        return mplew.getPacket();
    }

    public static byte[] 品克缤_敲敲_显示获得物品_2(int itemId) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
        mplew.write(5);
        mplew.write(1);
        mplew.writeInt(itemId);
        mplew.writeInt(1);

        return mplew.getPacket();
    }
    
    public static byte[] 尖兵永动机0(MapleCharacter chr, List<Pair<MapleBuffStat, Integer>> statups, int bufflenth) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (ServerProperties.IsLvkejian()) {
            String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 尖兵全息投影 --2   \r\n").toString();
            FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
        }
        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        PacketHelper.writeBuffMask(mplew, statups);
        mplew.writeShort(20);
        mplew.writeInt(30020232);
        mplew.writeInt(-65245599);
        mplew.writeShort(1);
        mplew.writeInt(36121054);
        mplew.writeInt(bufflenth);
        mplew.writeZeroBytes(9);
        mplew.writeInt(1000);
        mplew.writeZeroBytes(5);

        return mplew.getPacket();
    }
    
    public static byte[] 尖兵能量时间0(boolean 状态, int 能量电池最大时间, int 能量电池剩余时间) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (ServerProperties.IsLvkejian()) {
            String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 尖兵能量时间 --2   \r\n").toString();
            FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
        }

        mplew.writeShort(SendPacketOpcode.XENON_E.getValue());

        mplew.writeZeroBytes(44);
        mplew.writeInt(2);
        
        
        mplew.writeZeroBytes(8);

        mplew.writeInt(能量电池最大时间);
        mplew.write(6);
        mplew.writeInt(能量电池剩余时间);

        mplew.writeZeroBytes(18);
        

        return mplew.getPacket();
    }

    public static byte[] 尖兵开关能量效果0(boolean 状态) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (ServerProperties.IsLvkejian()) {
            String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 尖兵开关能量效果 --2   \r\n").toString();
            FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
        }
        mplew.writeShort(SendPacketOpcode.XENON_XG.getValue());

        if (状态 == true) {
            mplew.write(59);
        } else {
            mplew.write(60);
        }

        return mplew.getPacket();
    }

    public static byte[] 尖兵能量补给0(int 开启能量数量) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if (ServerProperties.IsLvkejian()) {
            String SendTo = new StringBuilder().append("\r\n时间：").append(FileoutputUtil.CurrentReadable_Time()).append("  开始通过 尖兵能量补给 --2   \r\n").toString();
            FileoutputUtil.packetLog("log\\辅助技能数据.log", SendTo);
        }
        mplew.writeShort(SendPacketOpcode.XENON_E.getValue());

        mplew.writeZeroBytes(38);
        mplew.writeInt(1);
        mplew.writeZeroBytes(10);

        mplew.writeShort(0x14);

        mplew.writeInt(30020232);
        mplew.writeInt(-2056147899);

        mplew.writeZeroBytes(18);

        return mplew.getPacket();
    }
    
    
    public static byte[] 夜光_刷新能量0(int 黑暗能量, int 光明能量, int 黑暗等级, int 光明等级) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.YG_NL.getValue());
        mplew.writeInt(黑暗能量);
        mplew.writeInt(光明能量);
        mplew.writeInt(黑暗等级);
        mplew.writeInt(光明等级);
        mplew.writeInt(74984423);

        return mplew.getPacket();
    }
    
    public static byte[] 夜光_生命潮汐0(int 模式) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        if ((模式 != 1) && (模式 != 2)) {
            模式 = 2;
        }
        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        mplew.writeZeroBytes(17);
        mplew.write(32);
        mplew.writeZeroBytes(30);
        mplew.writeShort(模式);
        mplew.writeInt(27110007);
        mplew.writeInt(500645789);
        mplew.writeZeroBytes(5);
        mplew.writeInt(30);
        mplew.writeZeroBytes(14);

        return mplew.getPacket();
    }

    public static byte[] 夜光_黑暗祝福0(int 珠子) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

        mplew.writeZeroBytes(17);
        mplew.write(8);
        mplew.writeZeroBytes(30);
        mplew.writeShort(珠子);
        mplew.writeInt(27100003);
        mplew.writeInt(500119371);
        mplew.writeZeroBytes(19);

        return mplew.getPacket();
    }
    
    public static byte[] 夜光_太阳火焰或月蚀0(int buffid, int 黑暗等级, int 光明等级, int 技能时间, List<Pair<MapleBuffStat, Integer>> statups) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());
        PacketHelper.writeBuffMask(mplew, statups);
        for (Pair stat : statups) {
            mplew.writeShort(((Integer) stat.getRight()).intValue());
            mplew.writeInt(buffid);
            mplew.writeInt(技能时间);
        }
        mplew.writeZeroBytes(5);
        mplew.writeInt(buffid);
        mplew.writeInt(buffid == 20040216 ? 274782075 : -300459317);
        mplew.writeLong(0L);
        mplew.writeInt(0);
        mplew.writeInt(1);
        mplew.writeInt(黑暗等级);
        mplew.writeInt(光明等级);
        mplew.writeInt(buffid == 20040217 ? 74782075 : -500575939);
        mplew.writeLong(0L);
        mplew.write(1);
        mplew.writeInt(0);

        return mplew.getPacket();
    }

    public static byte[] 夜光_平衡0(int buffid, int 黑暗等级, int 光明等级, int 技能时间, List<Pair<MapleBuffStat, Integer>> statups) {
        if (ServerProperties.ShowPacket()) {
            log.info(new StringBuilder().append("调用: ").append(new java.lang.Throwable().getStackTrace()[0]).toString());
        }
        
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.GIVE_BUFF.getValue());

        PacketHelper.writeBuffMask(mplew, statups);
        for (Pair stat : statups) {
            mplew.writeShort(((Integer) stat.getRight()).intValue());
            mplew.writeInt(20040219);
            mplew.writeInt(技能时间);
        }
        mplew.writeZeroBytes(5);
        mplew.writeInt(20040217);
        mplew.writeInt(494768341);
        mplew.writeInt(20040216);
        mplew.writeInt(494768341);

        mplew.writeInt(黑暗等级);
        mplew.writeInt(光明等级);
        mplew.writeInt(0);
        mplew.writeInt(0);
        mplew.writeInt(294768341);
        mplew.writeInt(0);
        mplew.writeInt(1000);
        mplew.write(1);
        mplew.writeInt(0);

        return mplew.getPacket();
    }
}

